Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
neonguyen1803
Frequent Visitor

Create a column random with a ratio of 80-20

I have a table with many rows, then I want to create a column in this table with random values: Yes, No with a ratio of 80% data for Yes - 20% data for No.

 

Thank you

3 REPLIES 3
nirali_arora
Resolver II
Resolver II

To do this you need index field or Incremental date time column

Then you need a new column =
var _sum = sum(Table[Value]) 
var _cumm = calculate(sum(Table[Value]) , filter(Table, Table[Index]) <= EARLIER(Table[Index]) )
return 
if(divide(_cumm,_sum), <=.8,"Yes", "No")

 

Power Query- Index Column: https://youtu.be/NS4esnCDqVw

 

Earlier: https://youtu.be/CVW6YwvHHi8

 

For measure way 
Pareto Analysis Again, 80% of sales, Order by Measure when REL position is used: https://youtu.be/GpoITi_tRIw

Your suggestion will return to Yes of 80% first of data. But I want to random value Yes and No with ratio 80% - 20%. Please view below sample

 

Customer IDYes/No
001Yes
002Yes
003No
004Yes
005Yes
006Yes
007No
008Yes
009Yes
010Yes

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.