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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

% Change showing 0% if a value is 0

I have the following measure that calculates % change 

 

% Vic Change =
VAR _Num =

CALCULATE (
IF (ISBLANK(DISTINCTCOUNT('Table'[ID])), 0, (DISTINCTCOUNT('Table'[ID]))),
FILTER(ALL('Date'[FY]),
'Date'[FY] = MAX('Date'[FY])))
VAR _Den =
CALCULATE (
IF (ISBLANK(DISTINCTCOUNT('Table'[ID])), 0, (DISTINCTCOUNT('Table'[ID]))),
FILTER(ALL('Date'[FY]),
'Date'[FY] = MAX('Date'[FY])-1))
 
VAR _PercentChange = IFERROR((_Num-_Den)/_Den ,0)
RETURN
_PercentChange

It works perfectly 99% of the time, however if the previous year that is being compared to (defined in variable "_Den") has a value of 0, then no matter what the current year is (variable "_Num"), the % change shows a value 0f 0%. For example, the following should say an increase of 200%, not 0%:

LloydThomas_0-1647440985248.png

 


As mentioned works fine other than this, and even works fine for if both values are 0, as expected 0% change is shown:

LloydThomas_1-1647440985249.png

 

 

It also works fine if the current year value is 0 and previous year is greater than 0.
Any help appreciated.

2 REPLIES 2
VIJAYKUMART
Resolver I
Resolver I

replace the VAR _PercentChange  with the below formula 
VAR _PercentChange   = DIVIDE((_Num-_Den),_Den)
hope this helps
Anonymous
Not applicable

Hi @VIJAYKUMART Thanks for the reply. This doesn't seem to work, it brings back a (blank) value instead. 

LloydThomas_0-1647532590618.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.