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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Using Randbetween for a column level condition

I want to assign random values between 1 to 30 for a particular category "C" alone,means all other categories will have a value of 0.

How can I achieve this?

randnum = if('Y[Categ]="C",rand(),0),this is my current calculated column,I have values between  0 and 1 returning,but I want values between 1 & 30 returning when the Categ is "C".
 
1 ACCEPTED SOLUTION

What error message are you getting?

 

Otherwise if Randbetween is not working you could use something like

 

Column = IF('Table'[Categ] = "C",RAND()*(30-1)+1,0)

 

 

View solution in original post

3 REPLIES 3
Gordonlilj
Solution Sage
Solution Sage

Hi,

 

Is this what you're after?

Column = IF('Table'[Categ] = "C",RANDBETWEEN(1,30),0)

 

Anonymous
Not applicable

I tried doing that but getting an error.Thanks for responding.

What error message are you getting?

 

Otherwise if Randbetween is not working you could use something like

 

Column = IF('Table'[Categ] = "C",RAND()*(30-1)+1,0)

 

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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