Forum Discussion
ianallen13
3 years agoHelper I
Power BI Question: Rounding up or down based on tenths place
Hello,
I have a request where the end-user is asking for averages of numbers for each term (easy enough), but then wants each term average then calculated and rounded either up or down based on the score. For example: if it's 2.40 then it's 2, but if it's 2.51 then it's 3. See below for example displayed.
So I'd assume that it would be an IF Statement, but how do I do it based on the tenths place of a number?
Any guidance is appreciated.
Thank you!
2 Replies
- ribisht17Super User
hi ianallen13
Please check
https://community.fabric.microsoft.com/t5/Desktop/Conditional-Rounding/td-p/984067
Ritesh
Mark my post as a solution if it helped you| Munde and Kudis (Ladies and Gentlemen) I like your Kudos!! !!
My YT Channel Dancing With Data !! Connect on Linkedin !!Power BI for Tableau Users - Greg_DecklerCommunity Champion
ianallen13 So ROUND is going to round .5 up so if you want to instead round based on .5 rounding down and .51 rounding up then perhaps something like this:
Rounded Average = VAR __Average = [Average] //your average measure VAR __Trunc = TRUNC( __Average ) VAR __Decimal = __Average - __Trunc VAR __Result = IF( __Decimal > .5, __Trunc + 1, __Trunc ) RETURN __Result