Forum Discussion
Need help with DAX for count
- 3 years ago
Hi ZeeMTee
You can add a flag column, which you can use as a filter.
It returns "yes" if the same part in the same month has more than 1 yes.
Dax formula for this calculated column :CountYes = if ( CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table', 'Table'[Pnumber], 'Table'[Month]),'Table'[Changed] = "Yes")>1, "yes", "blank")As you have it you can use it to filter your matrix :
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
Hi,
Thanks for assisting.
If I do a Pivot of the data and filter for Changed = Yes. I will get this result.
The cells in yellow should be discard as the count of Changed < 1.
From this table I would do COUNTA for respective months, and would get this table
The final table should look like this
Here is the sample data
| PartNumber | Month | Changed |
| A | Jan | Yes |
| A | Jan | Yes |
| A | Jan | Yes |
| A | Feb | Yes |
| A | Feb | No |
| A | Feb | Yes |
| A | Feb | Yes |
| A | Feb | No |
| B | Jan | Yes |
| B | Jan | Yes |
| B | Feb | No |
| B | Feb | Yes |
| B | Feb | No |
| C | Jan | Yes |
| C | Jan | No |
| C | Jan | No |
| C | Jan | No |
| C | Jan | No |
| C | Feb | Yes |
| C | Feb | No |
| C | Feb | Yes |
| C | Feb | Yes |
| C | Feb | Yes |
| D | Jan | Yes |
| D | Jan | Yes |
| D | Jan | Yes |
| D | Feb | No |
| D | Feb | No |
| D | Feb | No |
- Ritaf19833 years ago
Super User
Hi ZeeMTee
You can add a flag column, which you can use as a filter.
It returns "yes" if the same part in the same month has more than 1 yes.
Dax formula for this calculated column :CountYes = if ( CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table', 'Table'[Pnumber], 'Table'[Month]),'Table'[Changed] = "Yes")>1, "yes", "blank")As you have it you can use it to filter your matrix :
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
- ZeeMTee3 years agoNew Member
Thanks I have added another measure to CountOfYes = "Yes", so that I can get the PartNumber count.
CountIFYes = CALCULATE( DISTINCTCOUNT('Table'[PartNumber]), Filter('Table', 'Table'[CountOfYes]="Yes"))