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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Help with measure that counts rows ignoring a date slicer but also equal to a max date

Hello 

 

I am trying to create some visuals where my users will be able to compare the latest data to any point in time using a slicer.

 

I am trying to create a measure that filters to only count rows of my table that are equal to the MAX date in that table which I can do and looks like this:

 

Test = CALCULATE(COUNT(Data[Emp Count]),(filter(Dates,Dates[Date]=max(Data[Month]))))
 
This works as intended but I want to do is make it so it would be unaffected using a date slicer on my page which also uses a column from my Dates table.
 
Any help greatly appreciated.
 
thanks, 
1 ACCEPTED SOLUTION
kentyler
Solution Sage
Solution Sage

Try adding and ALL() filter to your CALCULATE statement. CALCULATE is the only function that can modify the filter context created by things like slicers.

Test = CALCULATE(COUNT(Data[Emp Count]),ALL(Data),(filter(Dates,Dates[Date]=max(Data[Month]))))

I learn something every time I answer a question

I'm a personal Power BI trainer 





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


View solution in original post

1 REPLY 1
kentyler
Solution Sage
Solution Sage

Try adding and ALL() filter to your CALCULATE statement. CALCULATE is the only function that can modify the filter context created by things like slicers.

Test = CALCULATE(COUNT(Data[Emp Count]),ALL(Data),(filter(Dates,Dates[Date]=max(Data[Month]))))

I learn something every time I answer a question

I'm a personal Power BI trainer 





Did this post answer your question? Mark it as a solution so others can find it!

Help when you know. Ask when you don't!




Join the conversation at We Talk BI find out more about me at Slow BI


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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