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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Jadreani
Frequent Visitor

Multiple conditions for price round

Hello,

 

I'd like to find a solution in DAX to create multiple condition to round the prices of a column depending a range of price.

 

For example:

Price rangeRound Formula
0-1ROUND(1) (to the decimal)
>1-10ROUND(0) (to the unit)
>10-100ROUND(0) (to the unit)
>100-1000MROUND(5)
>1000-10'000MROUND(50)
>10'000-100'000MROUND(100)
>100'000-1'000'000MROUND(1000)

 

Thanks so much for your kind help.

 

Jean-Yves

1 ACCEPTED SOLUTION
speedramps
Community Champion
Community Champion

Hu Jean-Yus

 

Your answer =

VAR myvalue = SELECTVALUE(youtable[yourcolumn])
RETURN


SWITCH(TRUE(),
// 0-1 ROUND(1) (to the decimal)
myvalue <= 1, ROUND(myvalue,1),

// >1-10 ROUND(0) (to the unit)
myvalue <= 10, ROUND(myvalue,0),

// >10-100 ROUND(0) (to the unit)
myvalue <= 100, ROUND(myvalue,0),

// >100-1000 MROUND(5)
myvalue <= 1000, ROUND((myvalue,5),

// >1000-10'000 MROUND(50)
myvalue <= 10000, ROUND((myvalue,50),

// >10'000-100'000 MROUND(100)
myvalue <= 100000, ROUND((myvalue,100),

// >100'000-1'000'000 MROUND(1000)
myvalue <= 1000000, ROUND((myvalue,1000),

myvalue

)

 

Please click thumbs up and accept as solution. Thank you.

You could impove performance by removing >1-10 became it is the same as >10-100 ROUND(0).

Alsonote  values over 1000000, will not be rounded

 

 

View solution in original post

2 REPLIES 2
speedramps
Community Champion
Community Champion

I helped you quickly,  so please help me with kudos. 

Please click the thumbs up and acccept solution buttons. Thank you ! 😎

speedramps
Community Champion
Community Champion

Hu Jean-Yus

 

Your answer =

VAR myvalue = SELECTVALUE(youtable[yourcolumn])
RETURN


SWITCH(TRUE(),
// 0-1 ROUND(1) (to the decimal)
myvalue <= 1, ROUND(myvalue,1),

// >1-10 ROUND(0) (to the unit)
myvalue <= 10, ROUND(myvalue,0),

// >10-100 ROUND(0) (to the unit)
myvalue <= 100, ROUND(myvalue,0),

// >100-1000 MROUND(5)
myvalue <= 1000, ROUND((myvalue,5),

// >1000-10'000 MROUND(50)
myvalue <= 10000, ROUND((myvalue,50),

// >10'000-100'000 MROUND(100)
myvalue <= 100000, ROUND((myvalue,100),

// >100'000-1'000'000 MROUND(1000)
myvalue <= 1000000, ROUND((myvalue,1000),

myvalue

)

 

Please click thumbs up and accept as solution. Thank you.

You could impove performance by removing >1-10 became it is the same as >10-100 ROUND(0).

Alsonote  values over 1000000, will not be rounded

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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