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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

COUNTIF in DAX Language

A COUNTIF is sorely missed in DAX. (The workaround with CALCULATE and FILTER is too cumbersome and complex for most users)
Status: Completed
Comments
jason_wongly
New Member
You can use COUNTX instead. Btw, CALCULATE and FILTER are most-learn functions in POWER BI, do encourage the users to learn them.
fbcideas_migusr
New Member
One of the beauties of DAX over Excel is that filtration (the "IF" or "IFS" step) is separated from the aggregation step (count, sum, average, minimum, etc.). Instead of introducing a new "IF" or "IFS" function for each type of aggregation (SUMIFS, MINIFS, etc.), you filter your data with FILTER and you use your normal aggregation function on that filtered table. In DAX, the equivalent of COUNTIF would be this: COUNTROWS(FILTER('Table',)) What is the workaround with CALCULATE and FILTER that you had in mind?
nishalit
New Member

You can leverage COUNTX for this. https://docs.microsoft.com/en-us/dax/countx-function-dax

fbcideas_migusr
New Member
Status changed to: Completed