Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
Hi everyone! Is there a way to add a string of text to random rows with specified quantity?
The "Sample" column below is what I want to achieve.
In this example, there are 4 rows with Red color, and the sampling % for red is 50%. Thus, for 2 random rows with red color (50% of 4) the text "for sampling" should be added.
Unit # | Color | Sampling % | Sample | Occurence | Required Sampling |
1 | Red | 50% | 4 | 2 | |
2 | Blue | 30% | For sampling | 1 | 1 |
3 | Black | 25% | For sampling | 1 | 1 |
4 | Red | 50% | For sampling | 4 | 2 |
5 | Red | 50% | 4 | 2 | |
6 | Red | 50% | For sampling | 4 | 2 |
So far I have added a column for occurrence count
Occurence = COUNTX(FILTER('Unit', EARLIER ('Unit'[Color] ) = 'Unit'[Color]),'Unit'[Color])
then multiplying it with the % to get the required number of sampling rounded up
Required Sampling = ROUNDUP('Unit'[Sampling %]*'Unit'[Occurence],0)
but I can't figure out how to implement the required # of sampling to random rows
or if there's a way to create non-repeating random numbers
Thanks in advance!
Solved! Go to Solution.
I was able to find a workaround for now by adding an index column then creating a column with the following formula :
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
User | Count |
---|---|
82 | |
42 | |
30 | |
27 | |
27 |