Forum Discussion
Pull Random 3% of Data
- 4 years ago
Alright, I remember how I did this previously. Took me a while, but I knew it could be done. Foregoing the half Red and half Blue on my wishlist, the way to create a new table with a random n% of rows from an existing table is to create a measure within the existing table as follows (using 3% as an example)
3% = CALCULATE(DISTINCTCOUNT('Table1'[Order Number])*.03)
Then create a new Table as using that measure:
3% = SAMPLE('Table1'[3%], 'Table1',0)
Then I can create a table visual based off of my new table, and add a slicer to select the Customer I want and it will pull a random 3% of that customer's orders.
Thanks all hope this helps someone else.
Alright, I remember how I did this previously. Took me a while, but I knew it could be done. Foregoing the half Red and half Blue on my wishlist, the way to create a new table with a random n% of rows from an existing table is to create a measure within the existing table as follows (using 3% as an example)
3% = CALCULATE(DISTINCTCOUNT('Table1'[Order Number])*.03)
Then create a new Table as using that measure:
3% = SAMPLE('Table1'[3%], 'Table1',0)
Then I can create a table visual based off of my new table, and add a slicer to select the Customer I want and it will pull a random 3% of that customer's orders.
Thanks all hope this helps someone else.
- Anonymous3 years agoNot applicable
Hi - I am trying to do the same - so i have managed to follow some of this and adapt it to a different dataset with names and ID numbers. Mine is 10% - trouble is the rows retrieved is correct in terms of quantity, but the actual rows themselves don't randomise each time i refresh... is there a way that i can get them to be random? but 10% of the total number of rows of data available?