Answered by:
DAX Count and Sum functions with condition

Question
-
Hi,
Can you please help me on DAX Count function with Condition
Exp: I have a column1, Column2 in Table TableA
I want to count on Column1 based on the condition Column2=1
Like =COUNT(Column1) WHERE Column2=1
If you know please share the formula
Thanks in Advance
Thank You,
Grace
Thursday, June 6, 2013 10:28 PM
Answers
-
Hi Grace -
You should be able to use CALCULATE with a filter argument like this:
=CALCULATE(COUNT(YourTable[Column1]),YourTable[Column2] = 1)
Let me know if that helps.Brent Greenwood, MS, MCITP, CBIP // Please mark correct answers and helpful posts // http://brentgreenwood.blogspot.com
- Proposed as answer by Gerhard BruecklMVP, Editor Friday, June 7, 2013 9:02 AM
- Marked as answer by Elvis Long Friday, June 14, 2013 1:56 AM
Friday, June 7, 2013 12:39 AMAnswerer
All replies
-
Hi Grace -
You should be able to use CALCULATE with a filter argument like this:
=CALCULATE(COUNT(YourTable[Column1]),YourTable[Column2] = 1)
Let me know if that helps.Brent Greenwood, MS, MCITP, CBIP // Please mark correct answers and helpful posts // http://brentgreenwood.blogspot.com
- Proposed as answer by Gerhard BruecklMVP, Editor Friday, June 7, 2013 9:02 AM
- Marked as answer by Elvis Long Friday, June 14, 2013 1:56 AM
Friday, June 7, 2013 12:39 AMAnswerer -
Can you do the same for distinct count ?Thursday, July 24, 2014 5:48 PM
-
CALCULATE( <expression>, <filter expression> ) is a very powerful and basic building block in DAX. If you replaced the COUNT() with a DISTINCTCOUNT(), it would work just fine.
Thursday, July 24, 2014 7:21 PM -
Thanks GregThursday, July 24, 2014 7:28 PM