Forum Discussion
DAX random sample
- 8 years ago
Hi Christann
To create a random sample table with DAX, I would use RAND() as suggested above, and create a table with an expression like this:
Random Selection = VAR SampleSize = 10 VAR TableWithRand = ADDCOLUMNS ( OriginalTable, "Rand", RAND () ) RETURN TOPN ( SampleSize, TableWithRand, [Rand] )The Random Selection table will end up with an extra column Rand but you can remove that if needed.
It appears that the SAMPLE function returns a deterministic sample.
Regards,
Owen
I think you are looking for RAND() function. Try to read more about it and it should solve your issue.
- Christann8 years agoAdvocate IV
From what I have read, it looks like the RAND() function creates new random numbers. I am looking for a random sampling of rows in a table, to be created as a new table. Thanks though!
- abhishekpati868 years agoHelper III
I have never tried this , but from an initial look Table. Range might be useful in this case. Though it is not entrely random but you can change the offset criteria.
- Christann8 years agoAdvocate IV
That uses the M langage. Can you combine M and Dax?