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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
LK1992
Frequent Visitor

How to add 2 lines for running total amount in current year and Previous Year in Line Chart?

Screen Shot 2024-02-28 at 6.37.29 PM.png

 I used 2 measures for running total this year and last year. 

Running Total MTCO2 = 
CALCULATE(
[Total MTCO2],
FILTER(
ALLSELECTED('GLTRANS'[Posting Date]),
ISONORAFTER('GLTRANS'[Posting Date], MAX('GLTRANS'[Posting Date]), DESC)
)
)
 

RunningTotalLastYear =

calculate( [Cummulative Spend], dateadd(GLTRANS[Posting Date].[Date], -1, year))

but then it does show 2 lines in 2 splited line chart. but I need to have overlapped line chart like below screenshot as of example.  Could you help how to creat measures to make line chart for running total this year and last year like below screenshots?

 
Screen Shot 2024-02-28 at 6.40.43 PM.png

 

I also tried with below another measures as well, but then it's not working neither.

Cummulative Spend = 
var __oneYearVisible = HASONEVALUE(GLTRANS[Posting Date].[Year] )
var __cummulativeSpend =
if (
__oneYearVisible,
 
CALCULATE(
[Running Total MTCO2],
DATESYTD( GLTRANS[Posting Date])
)  
)
return
    __cummulativeSpend
Cummulative Spend LY = 
var __cummulativeSpend =
CALCULATE(
[Cummulative Spend],
SAMEPERIODLASTYEAR( GLTRANS[Posting Date] )
)
return
__cummulativeSpend
2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi ! 

 

I can't open the link. Could you possibly share again?

 

Thanks!!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.