QuestionRandom sampling implementation in Tableau. Example: Random sampling top 0-9 random customers from the data set
Answer1. Create a calculation for Random number generationOption 1:Use RANDOM() function:RANDOM() Function Produces Inconsistent ResultsOption 2 :Use TabpyRandom function implementation for 0-9 :SCRIPT_INT("import randomreturn random.randint(0,9)",SUM([Sales]))2. Create another filter calculation INDEX()<[Random function implementation for 0-9]3. Put Customer name on Rows and Drag filter calculation above to Filters and select TrueEvery time the sheet is refreshed or the data source is, it will produce random 0-9 customers.
Additional InformationAnalytics extensions need to be enabled in order to use the sample workbook attached.Pass Expressions with Analytics Extensions
Did this article resolve the issue? Thank you for providing your feedback on the effectiveness of the article. Click here to return to our Support page. Open new Case Open a new case Continue Searching Click here to go to our Support page. Knowledge Base Get detailed answers and how-to step-by-step instructions for your issues and technical questions. Community Find and share solutions with our active community through forums, user groups and ideas. Product Help Browse a complete list of product manuals and guides. Available online, offline and PDF formats. Training and Tutorials Learn how to master Tableau’s products with our on-demand, live or class room training.