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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
SirBI
Frequent Visitor

Count Measure when decreasing date filter.

I need to count current "Active Members". 

Meaning, when I slide my date filter to the right, the count should not change, they are still active members. 

But I would like to have the count change when I slide my filter to the left, counting how many active members I had during that time period. 

 Is there a measure I can write?

 

I  also need to indentify Public counts, I created a PK date and Public column concatendate to link to my calendar table. 

 

SirBI_0-1679403559688.png

 

My below table:

 

display_namePublicfirst_grant_dtlast_grant_dtaccess_revoked_datepk
RedN11/16/202211/29/2022NULL2022-11-16T00:00:00.0000000ZN
BlueN7/26/20229/21/2022NULL2022-07-26T00:00:00.0000000ZN
GreenN10/12/20219/13/2022NULL2021-10-12T00:00:00.0000000ZN
YellowY7/1/202112/31/9999NULL2021-07-01T00:00:00.0000000ZY
PinkY7/1/202112/31/9999NULL2021-07-01T00:00:00.0000000ZY

 

1 ACCEPTED SOLUTION
halfglassdarkly
Responsive Resident
Responsive Resident

You'll want the date used for the slicer to be disconnected from the date fields in your table (either using an unrelated date dimension or by explicitly ignoring the slicer values in your main calculation context.

You can store the values from the slicer as variables e.g. something like:

Var MinDate = Min('Unrelated Date Table'[Date])

Var MaxDate = Max('Unrelated Date Table'[Date])

RETURN

Calculate(Count('table'[display_name]),

     ALLEXCEPT('table','table'[display_name]),

     'table'[first_grant_d]<=MaxDate && 'table'[last_grant_d]>=MinDate)

View solution in original post

1 REPLY 1
halfglassdarkly
Responsive Resident
Responsive Resident

You'll want the date used for the slicer to be disconnected from the date fields in your table (either using an unrelated date dimension or by explicitly ignoring the slicer values in your main calculation context.

You can store the values from the slicer as variables e.g. something like:

Var MinDate = Min('Unrelated Date Table'[Date])

Var MaxDate = Max('Unrelated Date Table'[Date])

RETURN

Calculate(Count('table'[display_name]),

     ALLEXCEPT('table','table'[display_name]),

     'table'[first_grant_d]<=MaxDate && 'table'[last_grant_d]>=MinDate)

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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