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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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