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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
gbpbi
Frequent Visitor

Current year sum compared to all previous years (Not cumulative)

Hello, I am trying to set up a measure that gives me a % difference of current sum of sales vs all previous year's. This explains roughly what I am aiming to do.

gbpbi_0-1741121250959.png


In this example 2024 is the current year, and the two rows below its sums are what I'm trying to figure a way to visualize in PowerBi. Now in 2025 there would be data for 2022-2025 so the visual I'm trying to make would be tracking % change of 2025 data from 2022, 2023, and 2024 separate from eachother.

1 ACCEPTED SOLUTION
gbpbi
Frequent Visitor

This was the measure that I used:

 
_Year % Diff to CY NIS =
VAR __Sales = [_NIS]
VAR __CYSales = CALCULATE([_NIS], DimDates[Year] = YEAR(TODAY()))
RETURN DIVIDE(__CYSales,__Sales,0) - 1
 
I then used "show values as rows" on the table settings and it got me what I was looking for. Thanks for the help.

View solution in original post

6 REPLIES 6
gbpbi
Frequent Visitor

This was the measure that I used:

 
_Year % Diff to CY NIS =
VAR __Sales = [_NIS]
VAR __CYSales = CALCULATE([_NIS], DimDates[Year] = YEAR(TODAY()))
RETURN DIVIDE(__CYSales,__Sales,0) - 1
 
I then used "show values as rows" on the table settings and it got me what I was looking for. Thanks for the help.
Anonymous
Not applicable

Hi @gbpbi 
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.

Anonymous
Not applicable

Hi @gbpbi 

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If their response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.

 

Anonymous
Not applicable

Hi @gbpbi 

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

Anonymous
Not applicable

Hi @gbpbi ,

First of all, I want to point out that your visual can not be fully implemented. It is not possible in Power BI to have a matrix with the original data in the top half and a few additional rows in the bottom half to calculate the percentage difference. You can only split the two parts and display them in two different matrices.

vjunyantmsft_0-1741140788881.png

In addition, I have added a new table here for sorting the months. This table may not exist in your data. You can adjust it by yourself. It will not have a big impact.

vjunyantmsft_1-1741141298528.png

vjunyantmsft_2-1741141313038.png

Then use this DAX to create a measure:

 

%Change = 
VAR _maxyear = MAXX(ALL('Table'), 'Table'[Year])
VAR _maxyearvalue = 
CALCULATE(
    SUM('Table'[Value]),
    'Table'[Year] = _maxyear
)
VAR _averageperyear = 
CALCULATE(
    AVERAGE('Table'[Value]),
    ALL('Table'),
    'Table'[Year] = MAX('Table'[Year])
)
VAR _averagemaxyear = 
CALCULATE(
    AVERAGE('Table'[Value]),
    ALL('Table'),
    'Table'[Year] = _maxyear
)
RETURN
IF(
    ISFILTERED('Month_Sort'[Month]),
    (_maxyearvalue - SUM('Table'[Value])) / SUM('Table'[Value]),
    (_averagemaxyear - _averageperyear) / _averageperyear
)

 

And the final output is as below:

vjunyantmsft_3-1741141442056.png

The Total part shows the %Change between the average values ​​of the Values ​​of the two years.

If you add the data for 2025 to the original data, the results returned by DAX will automatically change to a comparison between 2025 and other years without modifying DAX.

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.

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.

Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

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.