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

View all the Fabric Data Days sessions on demand. View schedule

Reply
rajanikanthr
Frequent Visitor

Cumulative count which ignores Date slicer but honors rest

data.JPG

 

I have data similar to this and currently have a measure which calculates distinct row count for each feature and until that date.

 

CumulativeRegistrations = CALCULATE(DISTINCTCOUNT(Previews[SubscriptionId]), FILTER (ALLEXCEPT(Previews, Previews[Feature]), Previews[Date] <= MAX(Previews[Date])))


I have an area chart with axis is Date , legend is feature and Values is the measure. and it's working perfectly.

 

But I have now added slicers for Date, customer and feature but the chart needs to honor these except Date in calculation.


Say I have selected Customer C1 and Feature F1 and Date slicer to start from 11/2. The value I want is 2 instead of 1, because there are 2 records in the table with C1 and F1 combination, as I changed formula to use ALLSELECTED which is skipping filtered out data.

 

How can I change formula to use filters for Feature and Customer but not Date. I still want the date slicer to be there so that chart shows the selected date range only.

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

 

  1. Create a Calendar Table
  2. Create a relatioship from the Date column in your base Data Table to the Date column in the Calendar Table
  3. In your visual, drag the Date column from the calendar table in your Filter/slicer.  Select 11/2/2017 in the slicer
  4. Write this measure

=CALCULATE(COUNTROWS(Data),DATESBETWEEN(Calendar[Date],MINX(ALL(Calendar),Calendar[Date]),MAX(Calendar[Date])))

 

Hope this helps.


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

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

 

  1. Create a Calendar Table
  2. Create a relatioship from the Date column in your base Data Table to the Date column in the Calendar Table
  3. In your visual, drag the Date column from the calendar table in your Filter/slicer.  Select 11/2/2017 in the slicer
  4. Write this measure

=CALCULATE(COUNTROWS(Data),DATESBETWEEN(Calendar[Date],MINX(ALL(Calendar),Calendar[Date]),MAX(Calendar[Date])))

 

Hope this helps.


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

it's working fine with Calendar table, but the date slicer shows the maximum date from Calendar.. is there any way I can restrict to Max date from the Data table so that it's easy for all kind of users in terms of scrolling the slicer .

Hi,

 

The Calendar table should be created using the New Table feature of PowerBI desktop (under modelling).  Write this formula there

 

=CALENDAR(MIN(Previews[Date]),MAX(Previews[Date]))


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

perfect... worked fine..

Thank you.


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

I suggest you creat a calendar table and use the date column in that table instead of the previews table. That way when you can just remove the filter from the calendar table, and nothing else simple using ALL. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors