Forum Discussion
Random Sample
- 4 years ago
Thanks for the response. I think I have solved with some Dax which creates a table for each column I want to randomise and forms a union of those tables. Its a long process but I think it will work. I just create a table per column for the sample spread?
Random Selection with category filter and sample size =
VAR SampleSize = XX
VAR Cat_Name1TableWithRand =
TOPN (SampleSize, ADDCOLUMNS ( FILTER('Table_Name', 'Table_Name'[Column1] = "Cat_Name1"), "Rand", RAND () ), [Rand])
VAR Cat_Name2TableWithRand =
TOPN (SampleSize, ADDCOLUMNS ( FILTER('Table_Name', 'Table_Name'[Column1] = "Cat_Name2"), "Rand", RAND () ), [Rand])
VAR Cat_Name3TableWithRand =
TOPN (SampleSize, ADDCOLUMNS ( FILTER('Table_Name', 'Table_Name'[Column1] = "Cat_Name3"), "Rand", RAND () ), [Rand])
VAR UnionTable =
UNION (Cat_Name1TableWithRand , Cat_Name2TableWithRand , Cat_Name3TableWithRand )
RETURN UnionTable
If there is a quicker way, then great!
Hi, D_HL
Do you want to randomly generate rate from the data in the next four columns?
There is no such method in powerbi, you need to define a complete rule yourself according to the classification.
Best Regards,
Community Support Team _ Janey