Power BI: show negative and positive percentage

I will explain different DAX formulas, one will work better than the others depending on what I need to do. For that, let’s take this data as example:

power bi

To see the result, first I will create a measure by clicking on “home -> new measure” and put the formula. Secondly, I will create a “card” in the visualization and in the “fields”, I put the “measure”.

power bi power bi

If I do a simple total of the first column, I get this result:

power bi

Now I want to show it as percentage, the easy way is:

ROUND(SUM('table'[argument]),2)&"%"

power bi

But as you can see, there is no the plus sign since the percentage is positive, to remediate it:

FORMAT(SUM('table'[argument])/100,"+0.00%;-0.00%")

power bi

Now, let’s do something else, I want the percentage between 2022 and 2021, my formula will be like this:

ROUND((CALCULATE(SUM('table'[argument1]),'table'[argument2]="xxx")/
CALCULATE(SUM('table'[argument1]),'table'[argument2]="xxx"))*100,2)&"%"

power bi

So to show the positive or negative sign, I can use the “format” option:

FORMAT((CALCULATE(SUM('table'[argument1]),'table'[argument2]="xxx")/
CALCULATE(SUM('table'[argument1]),'table'[argument2]="xxx")),"+0.00%;-0.00%")

power bi

Or I can use this option by defining a variable:

var npsign = ROUND((CALCULATE(SUM('table'[argument1]),'table'[argument2]="xxx")/
CALCULATE(SUM('table'[argument1]),'table'[argument2]="xxx"))*100,2)
RETURN IF(npsign>0,"+"&npsign&"%",npsign&"%")

power bi

Just to show the negative sign in case of negative percentage:

power bi

Interesting Topics