Forum Discussion

Fusilier2's avatar
Fusilier2
Helper V
1 year ago
Solved

Conditional number rounding

Can anybody recommend a solution to this:

I have monthly data values that will always be between 0% and 100% but never higher than 100%.

They are displayed in a visual with labels turned on. What I want to achieve for the data labels is, if the value is < 100% to display to 1 decimal point (e.g. 98.7%), but if the value = 100% to display with no decimal points )100%).

Is that possible? I presume by using a measure?

 

  • Hi Fusilier2 ,

     

    FormattedPercent =
    VAR BaseValue = SUM('Table'[PercentValue])
    RETURN
    IF(
    BaseValue = 1,
    FORMAT(BaseValue, "0%"),
    FORMAT(BaseValue, "0.0%")
    )

     

    Hope this helps!

3 Replies

  • BITomS's avatar
    BITomS
    Solution Supplier

    Hi Fusilier2 ,

     

    FormattedPercent =
    VAR BaseValue = SUM('Table'[PercentValue])
    RETURN
    IF(
    BaseValue = 1,
    FORMAT(BaseValue, "0%"),
    FORMAT(BaseValue, "0.0%")
    )

     

    Hope this helps!