Forum Discussion
PowerBi filter multiple columns with multiple filters
Hi,
Im struggling a little bit with an measure.
I have the following table.
ID Status Type Name
| 123 | accept | yes | yellow |
| 123 | accept | yes | |
| 456 | not possible | standard | green |
| 456 | not possible | standard | |
| 789 | not possible | standard | green |
| 135 | accept | no |
I want to distinctcount the ID column, and then calculate Type column = "Yes" and "No" AND the Status column = "not possible" and the Name column = "Green".
So the outcome must be: 4
ID Status Type Name
| 123 | accept | yes | yellow |
| 456 | not possible | standard | green |
| 789 | not possible | standard | green |
| 135 | accept | no |
My formula is:
This formula must be it.
Count =
CALCULATE(
DISTINCTCOUNT(tableA[ID]),(tableA[Type] = "yes" || tableA[Type] = "no") ||
(tableA[Status] = "not possible" &&
tableA[Name] = "green"))The only question I have now is, ID 456 is double and with distinctcount I get 1 count. But will it count the row with column "name" and "green" value or the other one. So is distinccount after the filters has been set or is it before the filters.
Hi Tinus1905
try below measure.Count of id =CALCULATE(DISTINCTCOUNT('Table'[ID]),AND('Table'[Status]="not possible" , 'Table'[Name]="green") || 'Table'[Type]="yes"|| 'Table'[Type]= "no")I hope I answered your question!
6 Replies
- Alican_CResolver II
Give it a shot with this;
Count =
CALCULATE(
DISTINCTCOUNT(tableA[ID]),
FILTER(
tableA,
(tableA[Type] = "yes" || tableA[Type] = "no") &&
tableA[Status] = "not possible" &&
tableA[Name] = "green"
)
)- Tinus1905Resolver I
Sadly the outcome is still 0.
- Alican_CResolver II
just realized that there isnt actually any ID matching with all conditions you looked for.
I highlighted values matching the condition with green. See below there is no single line meets your all
Type column = "Yes" and "No" AND the Status column = "not possible" and the Name column = "Green". .ID Status Type Name
123 accept yes yellow 123 accept yes 456 not possible standard green 456 not possible standard 789 not possible standard green 135 accept no - Tinus1905Resolver I
This formula must be it.
Count =
CALCULATE(
DISTINCTCOUNT(tableA[ID]),(tableA[Type] = "yes" || tableA[Type] = "no") ||
(tableA[Status] = "not possible" &&
tableA[Name] = "green"))The only question I have now is, ID 456 is double and with distinctcount I get 1 count. But will it count the row with column "name" and "green" value or the other one. So is distinccount after the filters has been set or is it before the filters.