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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Petr__
Helper III
Helper III

CALCULATE + FILTER +ALL

Hello guys,

 

I have following table

 

month
1
2
3
4
5
6

 

And I need to create measure  that will return count of month and not be affected by selection/filter of months, I create this DAX formula, but for unknown reason it is not working, any reason why? and what should be correct syntax ?

 

measure= CALCULATE(DISTINCTCOUNT(Table[month]),ALL(Table,Table[month])))

 

 

1 ACCEPTED SOLUTION

@Petr__ 

 

You set a filter on Date column so use one of these:

 

count_m_fix = CALCULATE(DISTINCTCOUNT(Sheet1[y_m]),ALL(Sheet1))
 
or 
 
count_m_fix = CALCULATE(DISTINCTCOUNT(Sheet1[y_m]),ALL(Sheet1[Date]))
 
 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/


 

 

View solution in original post

10 REPLIES 10
VahidDM
Super User
Super User

HI @Petr__ 

 

Try this:

 

measure= CALCULATE(DISTINCTCOUNT(Table[month]),ALL(Table[month]))

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Hell @Vahid  this is what I mentioned in 2nd post (I have typo here with ")") but it doesn t work

 

@Petr__ 

 

Can you share you PBIX file?

or try this if you set a filter on month and you want to ignore that:

 

measure =
CALCULATE ( DISTINCTCOUNT ( Table[Month] ), REMOVEFILTERS ( Table[Month] ) )

 

  

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

@VahidDMno problem and how ?? pbix is not supported here

 

@Petr__ 

 

upload it on https://wetransfer.com/ and share the link here.

 

 

@VahidDM  got it...I was filtering on the different column than filter was set up in the report

 

count_m_fix = CALCULATE(DISTINCTCOUNT(Sheet1[y_m]),ALL(Sheet1[Date]))
 
is correct in my case, we were right, I just switch the filter 😄
 
thank you so much for participation
 

@Petr__ 

 

You set a filter on Date column so use one of these:

 

count_m_fix = CALCULATE(DISTINCTCOUNT(Sheet1[y_m]),ALL(Sheet1))
 
or 
 
count_m_fix = CALCULATE(DISTINCTCOUNT(Sheet1[y_m]),ALL(Sheet1[Date]))
 
 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/


 

 

Also find it, few minutes after you 😄 kudos sent 🙂

Petr__
Helper III
Helper III

I also tried

measure

= CALCULATE(DISTINCTCOUNT(Table[Month]),ALL(Table[Month]))
 
but when I changed filter on the page this measure is updated as well, instead of to be fixed

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.