Forum Discussion
COUNTIFS Functionality in DAX
Trying to find a DAX equivilent to:
ACTIVITY =COUNTIFS([fault_code],[@[fault_code]],[equipment_id],[@[equipment_id]])
Have experimented with COUNT and CALCULATE but can't find a syntax that works, all column headers are in the same table, as always any and all help gratefully received
Stuart
According to your description, you want to count rows which meet the criteria. Right?
You can create a measure like below:
COUNTIFS = CALCULATE ( COUNTROWS ( Table ), FILTER ( Table, Table[fault_code] = fault_code1 && Table[equipment_id] = equipment_id1 ) )Regards,
12 Replies
- SeanCommunity Champion
Although I still use Excel I have not done anything in regular tables (meaning not PowerPivot tables) in years...
So with this caveat I belive this is the equivalent
Activity COLUMN = IF ( 'Table'[fault_code] = BLANK () || 'Table'[equipment_id] = BLANK (), 0, 1 )
Hopefully this is the desired outcome! :smileyhappy:
Good Luck! :smileyhappy:
- Stoo48Frequent Visitor
Sean
Thanks again, not quitre returning the results I was hoping for, its populated the retuurn column with a 1 or 0, similar to when you would build a truth table to conditionally format something, In excel the CONTIFS when set as described counts occurences of in this case Fault_Code.
Many thanks for input, but back to the drawing board on this for now.
Stuart
- v-sihou-msftMicrosoft Employee
According to your description, you want to count rows which meet the criteria. Right?
You can create a measure like below:
COUNTIFS = CALCULATE ( COUNTROWS ( Table ), FILTER ( Table, Table[fault_code] = fault_code1 && Table[equipment_id] = equipment_id1 ) )Regards,