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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
anwarbi
Helper III
Helper III

Rounding down of Decimals in case of Ties

Hi, 

 

Can anyone please help me to fix the rounding of decimal value which is an average value resulting from a measure that i have created.

 

E.g.

In cases where the average value is 7.250 (a tie situation), when looked at single decimal, the result I am getting in power bi report is 7.3, however i want to have 7.2 as a result. (rounding up in case of ties).

 

And in other cases where the average value is 7.260 then it should be 7.3.

 

Appreciate your help.  @amitchandak 

1 ACCEPTED SOLUTION
rsbin
Community Champion
Community Champion

@anwarbi ,

In DAX, I prefer using the SWITCH Statement.  Similar to IF, but I find it cleaner and easier.

Average result Rounded = SWITCH(
                             TRUE(),
                            ( [Average result]*10 - TRUNC( [Average result]*10, 0 )) <= .5, ROUNDDOWN(  [Average result], 1 ),
                            ROUNDUP( [Average result], 1 ))

Average result   Average result Rounded

7.25 7.2
7.26 7.3
1.25 1.2
1.26 1.3

Hope you are able to get this to work for you.

Regards,

View solution in original post

9 REPLIES 9
parry2k
Super User
Super User

@anwarbi yes it will not work for measure, you need to use DAX function ROUND ROUND function (DAX) - DAX | Microsoft Docs

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Not really sure, How round can be applies as it will be one directional Round up or down. 

 

I am looking to round down only incase where the value is tied.

rsbin
Community Champion
Community Champion

@anwarbi ,

DAX has ROUNDUP and ROUNDOWN functions.  With these you can then specify how you want your Measure to be Rounded.

Regards,

I want to conditonally round down tie cases where the value is e.g. 1.25 so the result should be 1.2

 

but where the value is 1.26, I want them to round up to 1.3

rsbin
Community Champion
Community Champion

@anwarbi ,

Are you able to share the Measure you are working with?  It would better help me to structure your Conditional Rounding.

I want the conditional round function to apply on the below measure. 

 
Average result= CALCULATE(AVERAGEX(VALUES('Country'[Company_names]),CALCULATE(AVERAGE('Table1'[points]),'Table1'[related companies]<>"",'Table1'[mapping]<>"")),ALL('Table1'[Company]))
rsbin
Community Champion
Community Champion

@anwarbi ,

In DAX, I prefer using the SWITCH Statement.  Similar to IF, but I find it cleaner and easier.

Average result Rounded = SWITCH(
                             TRUE(),
                            ( [Average result]*10 - TRUNC( [Average result]*10, 0 )) <= .5, ROUNDDOWN(  [Average result], 1 ),
                            ROUNDUP( [Average result], 1 ))

Average result   Average result Rounded

7.25 7.2
7.26 7.3
1.25 1.2
1.26 1.3

Hope you are able to get this to work for you.

Regards,

parry2k
Super User
Super User

@anwarbi check this and apply as you see fit. Number.Round - PowerQuery M | Microsoft Docs

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

I have to apply this on measure that I have created which calculates average value. I am not sure, how this can be applied to a measure?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.