I want to format DAX measure so that value 0.105
is displayed as +10.5%
, and value -0.105
is displayed as -10.5%
. Important for me is the plus sign. I failed using FORMAT(measure, "+0.0%")
.
I cannot find anything helpful in FORMAT
function doc:
https://msdn.microsoft.com/query-bi/dax/custom-numeric-formats-for-the-format-function
The only solution I can think of is handling it with IF
or SWITCH
function. Is there a way to avoid it?
IF(variable>0, "+"&variable, variable)
You need to create custom format for both positive and negative numbers:
Formatted Value = FORMAT( [Measure], "+0.0%;-0.0%")
Result:
In general, custom format string consists of 4 parts, separated by ;
Positive values; Negative values; Zero values; Text values
One section is required, others are optional. So, to avoid + in front of zero, a full code might be:
Formatted Value = FORMAT( [Measure], "+0.0%;-0.0%;"0")
I'm a bit late to the game perhaps. And yes, formatting negative numbers in parentheses was a bit difficult in Power BI before. As other answers suggest, it would involve the FORMAT function. But today you can use custom formatting for a measure. For example "#,##0.0, (#.##0.0)". Hope that helps. You can find a more elaborate explanation here:
Format Negative values between Parentheses
Keep crushing it!
Rick
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With