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
Anonymous
Not applicable

Running total in a line chart after a month

 

Hello, I'm trying to do a report (Sample PBIX ) for a project. The spent is the actual column, the old baseline is the blue line and the new baseline is the orange line. 

I need to hide in the chart, the highlighted part of the orange line, basically, the line before a date which is where we need it to be shown. 

 

I'm using this measure but if I filter it with the previous dates it will not work properly and show no cummulative data, only the data from the starting month and onwards.

New Baseline = CALCULATE(sUM(Sheet1[Amount]),FILTER(Sheet1,Sheet1[Month]<=MAX(Sheet1[Month])),Sheet1[Record Type]="New Baseline")
 
Thanks for any guidance on this!.

 

Chart.PNG

1 ACCEPTED SOLUTION

Hello @sebabordon ,

First, create a slicer table as follows:

Slicer table = VALUES(Sheet1[Month])

Next, create 2 measures as follows:

New Baseline = CALCULATE(sUM(Sheet1[Amount]),FILTER(Sheet1,Sheet1[Month]>=SELECTEDVALUE('Slicer table'[Month])),Sheet1[Record Type]="New Baseline")
Old Baseline = CALCULATE(sUM(Sheet1[Amount]),FILTER(Sheet1,Sheet1[Month]<=SELECTEDVALUE('Slicer table'[Month])),Sheet1[Record Type]="Old Baseline")

And you'll see:

Screenshot 2020-09-22 120843.png

For the related .pbix file, see attachment pls.

Saludos
Kelly
Have I answered your question? Mark my position as a solution!

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous , I such case prefer date. Or month year in YYYYMM format

 

New Baseline = CALCULATE(sUM(Sheet1[Amount]),FILTER(allselected(Sheet1),Sheet1[Date]<=MAX(Sheet1[Date])),Sheet1[Record Type]="New Baseline")

 

best is you use a date table or month date , joined with this table

New Baseline = CALCULATE(sUM(Sheet1[Amount]),FILTER(allselected(Date),Date[Date]<=MAX(Date[Date])),Sheet1[Record Type]="New Baseline")

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

I just did that with a calendar table and it seems to work using the measure below, nevertheless using the same concepts to create the measure on my original table produces incorrect output. ;(

 

New Baseline = CALCULATE(sUM(Sheet1[Amount]),Sheet1[Month]>=DATE("2020","09","30"),FILTER(Sheet1,Sheet1[Month]<=MAX(Sheet1[Month])),Sheet1[Record Type]="New Baseline")

 image.png

Hello @sebabordon ,

First, create a slicer table as follows:

Slicer table = VALUES(Sheet1[Month])

Next, create 2 measures as follows:

New Baseline = CALCULATE(sUM(Sheet1[Amount]),FILTER(Sheet1,Sheet1[Month]>=SELECTEDVALUE('Slicer table'[Month])),Sheet1[Record Type]="New Baseline")
Old Baseline = CALCULATE(sUM(Sheet1[Amount]),FILTER(Sheet1,Sheet1[Month]<=SELECTEDVALUE('Slicer table'[Month])),Sheet1[Record Type]="Old Baseline")

And you'll see:

Screenshot 2020-09-22 120843.png

For the related .pbix file, see attachment pls.

Saludos
Kelly
Have I answered your question? Mark my position as a solution!
Anonymous
Not applicable

Thanks for the solution!, I've ended touching the data (since already had a plan to do it), but this works properly as an alternate option. I'll save it for the future.

P.S. I Do not understand why the posts are translated to spanish...

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.