Loading

Random sampling implementation

Julkaisupäivä: Feb 28, 2025
Tehtävä

Random sampling implementation in Tableau. Example: Random sampling top 0-9 random customers from the data set

 

Vaiheet
1. Create a calculation for Random number generation

Option 1:
Use RANDOM() function:
RANDOM() Function Produces Inconsistent Results

Option 2 :
Use Tabpy

Random function implementation for 0-9 :
SCRIPT_INT("import random
return 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 True

Every time the sheet is refreshed or the data source is, it will produce random 0-9 customers.
Lisäresurssit
Analytics extensions need to be enabled in order to use the sample workbook attached.
Pass Expressions with Analytics Extensions
 
Knowledge-artikkelin numero

001456765

Liitteet

random_sampling.twbx

2370 KB

 
Ladataan
Salesforce Help | Article