Forum Discussion
Adding new column / replace column in Power Bi
- 5 years ago
You can get a similar result with Power Query. First store all possible regions in a separate table. Add an index column to this table. I name the table as "Regions".
In original table, add an index column first. This column will not be used, but without it the random column cannot be added correctly.
Then add a custom column using Int16.From(Number.RandomBetween(0, List.Max(Regions[Index]))). I name this column as RandomRegionIndex. This column has random numbers.
At last, merge Regions table to this table. Select RandomRegionIndex column in this table and Index column in Regions table to match. After merging, expand the table column and select only Region column to add to this table.
Reference: Random Number Generation in Power BI | Sandeep Pawar (pawarbi.github.io)
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
You can get a similar result with Power Query. First store all possible regions in a separate table. Add an index column to this table. I name the table as "Regions".
In original table, add an index column first. This column will not be used, but without it the random column cannot be added correctly.
Then add a custom column using Int16.From(Number.RandomBetween(0, List.Max(Regions[Index]))). I name this column as RandomRegionIndex. This column has random numbers.
At last, merge Regions table to this table. Select RandomRegionIndex column in this table and Index column in Regions table to match. After merging, expand the table column and select only Region column to add to this table.
Reference: Random Number Generation in Power BI | Sandeep Pawar (pawarbi.github.io)
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.