Forum Discussion
How to create countifs in DAX - replicate Excel countifs
- 6 years ago
Hi Anonymous
use below dax, it should work
Countifs=
var delivery = 'Table'[Delivery]
var salesdoc = 'Table'[SalesDoc]
var item = 'Table'[Item]RETURN
COUNTROWS(
FILTER(
all('Table'),
delivery='Table'[Delivery] &&
salesdoc=''Table'[SalesDoc] &&
item='Table'[Item]))Please change the table name as per your table name, please let me know if this works for you.
It worked! I had to change "item" to "item1" because I got a red error line, but now it worked.
Can you tell me how this is working so I can learn please?
Hi Anonymous
Very glad it worked for you, in order to answer your question.
Basically it's similar logic of countifs in excel.
We are filtering all three columns with 'AND' operator as per the criteria at row level and then counting the rows. Hope this helps, feel free to ask more questions.
Thanks