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
johannn
New Member

Cumulative totals - unable to display current year vs last year total

Good day,

 

Very new to Power BI. 

 

I have managed to build two measure with rolling totals for current year and last year.

 

The problem is to display the current year vs last year in the same line chart. The line chart displays cumulative (rolling totals) when '2021&2022'[TXDATE] is used on x-axis. I cannot get month to be cumulative and display 2021 vs 2022 by month in line graph.

 

Open this report >

 

Tester 202204 - Power BI

 

Please assist

 

 

 

 

1 REPLY 1
Anonymous
Not applicable

Hi @johannn ,

 

Sorry for that I could not access your reports. By the way, for security, please do not directly share your report links on the community.

You may provide some dummy data and the expected outputs instead to help us clarify your scenario.

Refer to:

How to provide sample data in the Power BI Forum - Microsoft Power BI Community

How to Get Your Question Answered Quickly - Microsoft Power BI Community

 

 

Based on your description, I have managed to build two measure with rolling totals for current year and last year.

You may use SWITCH() like:

Measure = SWITCH(MAX('Table'[Year]),2022,[Current],2021,[Previous])

Eyelyn9_0-1651475103648.png

 

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

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.