Forum Discussion
COUNTIFS Functionality in DAX
- 9 years ago
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,
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,
what i'm looking for is a COUNTIFS that shows the # of times that each combo shows up:
INPUT:
NAME - COLOR
mark - red
mark - red
mark - blue
john - red
john - blue
john - yellow
OUTPUT:
NAME - COLOR - COUNT
mark - red - 2
mark - red - 2
mark - blue - 1
john - red - 1
john - blue - 1
john - yellow - 1
- Sean8 years agoCommunity Champion
If you just want the count you can achieve this without any Measures or Calculated Columns.
Just create a Matrix.
Place Name in Rows - place Color in Columns - finally place either Name or Color in Values and change to display Count.
If you insist on having a COLUMN with this information
Concatenate the possible Name-Color combinations in a column and then count the results of that column
So first create a COLUMN:
Column = 'Table'[Name]&"-"&"'Table'[Color]
then create a COLUMN:
Countifs Column = CALCULATE ( COUNTA ( 'Table'[Column] ), ALLEXCEPT('Table', 'Table'[Column] ) )
That should do it! Good Luck! :smileyhappy:
- vollmers8 years agoRegular Visitor
you are awesome. i'm going to keep bugging you. congrats :)
I have 100s of thousands of rows and thousands of unique combinations.
- GlassShark15 years agoHelper III
This should be the solution - this is the closest i can see to an alternative to excel's COUNTIF function. Alot of the other solutions require you to specify each variable or create a seperate list - this allows the variables to change by row. Thanks 🙂