Forum Discussion
Random Sample per Category
- Anonymous5 years ago
I don't really know why those 2 specific orders are shown... I just used the standard function SAMPLE(). Please go through the following link and you can further parametrize the function.
https://docs.microsoft.com/en-us/dax/sample-function-dax
If this solution does not meet your requirements, then you will have to consider ranking the orders using RANKX() and then use RANDBETWEEN() to generate a random number between the lowest and highest rank of each category and then pick any two randomly for each category, then do a cross join or use GENERATE in that context.
I don't really know why those 2 specific orders are shown... I just used the standard function SAMPLE(). Please go through the following link and you can further parametrize the function.
https://docs.microsoft.com/en-us/dax/sample-function-dax
If this solution does not meet your requirements, then you will have to consider ranking the orders using RANKX() and then use RANDBETWEEN() to generate a random number between the lowest and highest rank of each category and then pick any two randomly for each category, then do a cross join or use GENERATE in that context.
Thank you so much for your time Anonymous, Yes that becomes deterministic value. I did the same as you suggested added RAND() column and created a table as follows