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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

how to dynamically control where cumulative total begins

I have the following pbix file:

https://drive.google.com/file/d/10JmaeMYyHXXzxQ8_TJtcjliivs2SZL8X/view?usp=sharing

 

It's a simple sales data model, with dimensions of month and store.  Two unique features of this report are that the Month axis in the main visual runs in reverse, and that the measures on this visual need to only display in the Time Range selected (but still show the entire time range in the axis of the visual).  I have achieved this through a disconnected table, a measure that utilizes a switch, and "Show items with no data" on the shared axis.

 

I need to make the [Cumulative Total Sales] measure begin its running total at the minimum Month of the filter context (i.e., relative to Time Range selected), not at the minimum Month in the visual (which is always Jan 19).  For example, for filter context:

Store Name = "A"

Time Range = "Last 6 Months"

 

the [Cumulative Total Sales] measure needs to start its running total at Apr 19, as that is where the first non-zero [Total Sales] is at, not at Jan 19 (which is the minimum of the chart).

 

Similar, for filter context:
Store Name = "C"

Time Range = "Last 3 Months"

 

the [Cumulative Total Sales] shouldn't be displayed at all, since it doesn't have any sales in the last 3 months.

 

How can I achieve this?  I know that I need to do something to my __min_month variable in my [Cumulative Total Sales] measure, but I don't know what to do.

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , I think with allselected it should consider the filter

 

example

 

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(allselected(date),date[date] <=max(date[Date])))
Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(allselected(Sales),Sales[Sales Date] <=max(Sales[Sales Date])))

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

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , I think with allselected it should consider the filter

 

example

 

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(allselected(date),date[date] <=max(date[Date])))
Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(allselected(Sales),Sales[Sales Date] <=max(Sales[Sales Date])))

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

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Solution Authors