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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
gbarr12345
Post Prodigy
Post Prodigy

Percentage difference measure

Hi,

 

I have a measure to get the percentage difference for year 1 between depletion and exports.

 

I'm looking to have this measure to do the percentage difference for year 2, year 3 and year 4 also in the one code.

 

Please find my measure below:

 

Year 1 % difference =
VAR Dep = [Depletion First 12 Months]
VAR Exports = [USA Exports First 12 Months]
RETURN
IF(
    Exports <> 0,
    DIVIDE(Dep, Exports, 0),
    BLANK()
)
 
The measure works for year 1 but when I change the year to year 2, 3 or 4 the card percentage doesn't change.
 
See images below.
 
Can anyone help me update my measure to make this work please?
 
Any help would be greatly appreciated! 
 
gbarr12345_0-1723083129319.png

 

gbarr12345_1-1723083136722.png

 

gbarr12345_2-1723083215086.png

 

gbarr12345_3-1723083221578.png

 

gbarr12345_4-1723083231603.png

 

gbarr12345_5-1723083237876.png

 

gbarr12345_6-1723083245423.png

 

gbarr12345_7-1723083251698.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @gbarr12345 ,

Ritaf1983 Thanks for your concern about this case!
And @gbarr12345 , the problem should be with these two measures of yours:

vjunyantmsft_0-1723430091156.png


Here I build a sample data myself:

vjunyantmsft_1-1723430113628.png

Measures:

Depletion First 12 Months = 
CALCULATE(
    SUM('Table'[Depletion]),
    ALL('Table'),
    MONTH('Table'[Date]) >= 1 && MONTH('Table'[Date]) <= 12 && 'Table'[Year] IN VALUES('Table'[Year])
)
Exports First 12 Months = 
CALCULATE(
    SUM('Table'[Exports]),
    ALL('Table'),
    MONTH('Table'[Date]) >= 1 && MONTH('Table'[Date]) <= 12 && 'Table'[Year] IN VALUES('Table'[Year])
)
Year 1 % difference = 
VAR Dep = [Depletion First 12 Months]
VAR Exports = [Exports First 12 Months]
RETURN
IF(
    Exports <> 0,
    DIVIDE(Dep, Exports, 0),
    BLANK()
)

And the final output is as below:

vjunyantmsft_2-1723430178285.png

vjunyantmsft_3-1723430184988.png

vjunyantmsft_4-1723430191253.png

vjunyantmsft_5-1723430215583.png

vjunyantmsft_6-1723430223046.png

 

If there is still a problem, could you please provide your sample data, and the DAX you created for these two measures, please!

Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @gbarr12345 ,

Ritaf1983 Thanks for your concern about this case!
And @gbarr12345 , the problem should be with these two measures of yours:

vjunyantmsft_0-1723430091156.png


Here I build a sample data myself:

vjunyantmsft_1-1723430113628.png

Measures:

Depletion First 12 Months = 
CALCULATE(
    SUM('Table'[Depletion]),
    ALL('Table'),
    MONTH('Table'[Date]) >= 1 && MONTH('Table'[Date]) <= 12 && 'Table'[Year] IN VALUES('Table'[Year])
)
Exports First 12 Months = 
CALCULATE(
    SUM('Table'[Exports]),
    ALL('Table'),
    MONTH('Table'[Date]) >= 1 && MONTH('Table'[Date]) <= 12 && 'Table'[Year] IN VALUES('Table'[Year])
)
Year 1 % difference = 
VAR Dep = [Depletion First 12 Months]
VAR Exports = [Exports First 12 Months]
RETURN
IF(
    Exports <> 0,
    DIVIDE(Dep, Exports, 0),
    BLANK()
)

And the final output is as below:

vjunyantmsft_2-1723430178285.png

vjunyantmsft_3-1723430184988.png

vjunyantmsft_4-1723430191253.png

vjunyantmsft_5-1723430215583.png

vjunyantmsft_6-1723430223046.png

 

If there is still a problem, could you please provide your sample data, and the DAX you created for these two measures, please!

Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

That works! Thank you so much!

Ritaf1983
Super User
Super User

Hi @gbarr12345 

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.