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 September 15. Request your voucher.

Reply
monge
Regular Visitor

Comparing running totals of different periods in the same line chart

I'm trying to compare running totals of different periods that are user defined through date slicers. The fact table is rather simple, a date column with the selling date and another column with the selling value. Something like this:

WhatsApp Image 2024-04-03 at 09.36.46.jpeg

There are other tables in the model and all dates are linked to a calendar table. What I'm trying to do is to create two running totals of the "Value" column where the time periods for it are user defined through date slicers, and then use these two measures in the same line chart, even though the time periods might be different. I know I can create the running total using a measure like this

 

 

CUMSUM = CALCULATE(
               SUM('FACT TABLE'[Value]),
               FILTER(ALLSELECTED(Calendar), Calendar[Date] <= MAX(Calendar[Date])
              )

 

 

 But I'm not sure how to merge together two measures in the same line chart due to the different chosen periods. So, what I want is:

  • Create the running total CUMSUM1 of the "Value" column, where the time period for the calculation is defined by date slicer 1;
  • Create the running total CUMSUM2 of the "Value" column, where the time period for the calculation is defined by date slicer 2;
  • Merge then together in the same line chart even though the time periods are different.

I appreciate any help with this!
Thank you!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @monge 

 

Based on your description, I have created some measures to achieve the effect you are looking for. Following picture shows the effect of the display.

vyaningymsft_0-1712195439161.pngvyaningymsft_1-1712195460120.png

 

Measure:

SumValue =
CALCULATE (
MAX ( 'Fact Table'[value] ),
FILTER (
'Fact Table',
'Fact Table'[date]
IN ALLSELECTED ( 'Date 1'[date 1] )
|| SELECTEDVALUE ( 'Fact Table'[date] ) IN ALLSELECTED ( 'Date 2'[date 2] )
)
)


Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

I cannot visualise that line chart.  If 2 non overlapping line time periods are selected, then what should appear on the X-axis?


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

Hi, @monge 

 

Based on your description, I have created some measures to achieve the effect you are looking for. Following picture shows the effect of the display.

vyaningymsft_0-1712195439161.pngvyaningymsft_1-1712195460120.png

 

Measure:

SumValue =
CALCULATE (
MAX ( 'Fact Table'[value] ),
FILTER (
'Fact Table',
'Fact Table'[date]
IN ALLSELECTED ( 'Date 1'[date 1] )
|| SELECTEDVALUE ( 'Fact Table'[date] ) IN ALLSELECTED ( 'Date 2'[date 2] )
)
)


Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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