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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
Train23
Frequent Visitor

DAX Help

Hello I need some help with the following DAX Syntax.

 

I have a Measure [total qty] and need to get some DAX to do the following:

 

If [total qty] < 1000, Then Divide[total qty] by 1.  If [total qty] < 5000 Then Divide [total qty] by 2, IF [total qty] < 50000, Then Divide [total qty] by 4, IF [total qty] > 50000 then Divide [total qty] by 6.

 

The multiple conditions are tripping me up.

Thank you

1 ACCEPTED SOLUTION
vicky_
Super User
Super User

You can use the SWITCH function to avoid multiple IF statements - i.e

 

Your Measure = SWITCH(TRUE(), 
    [total qty] < 1000, Divide([total qty], 1),
    [total qty] < 5000 Divide([total qty], 2), 
    [total qty] < 50000, Divide([total qty], 4),
    [total qty] > 50000, Divide([total qty], 6)
)

 

View solution in original post

2 REPLIES 2
vicky_
Super User
Super User

You can use the SWITCH function to avoid multiple IF statements - i.e

 

Your Measure = SWITCH(TRUE(), 
    [total qty] < 1000, Divide([total qty], 1),
    [total qty] < 5000 Divide([total qty], 2), 
    [total qty] < 50000, Divide([total qty], 4),
    [total qty] > 50000, Divide([total qty], 6)
)

 

Vicki, you ROCK thank you so very much, this WORKS.  I have spent the last 2 days trying to get it working.  THANK YOU for being part of this great community.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.