Forum Discussion
DAX measure
Hello. I need help!!!
I'm having trouble creating a dax measure. I have a table with person ID / appliance status ID / appliance status ID.
I want to build a measure that tells me how many people have appliance 1 and in state 2, and at the same time have appliance 15 in state 3.
The person may have repeated appliances and in different states. I need to count the people who meet that condition
The table has such a shape
| Id persona | Id appliance | Id state |
| 1 | 1 | 1 |
| 1 | 1 | 2 |
| 1 | 15 | 3 |
| 2 | 15 | 1 |
| 2 | 1 | 1 |
| 3 | 1 | 2 |
| 3 | 1 | 2 |
| 3 | 15 | 2 |
3 | 15 | 1 |
| 4 | 1 | 1 |
| 4 | 1 | 2 |
| 4 | 15 | 1 |
| 4 | 15 | 3 |
@Syndicate_Admin , Try a measure like
countx(filter(summarize(TABLE, Table[Id persona], "_1", calculate(count(Table[Id persona]), filter(Table, table[Id appliance]-1 && table[Id state] ?2))
, "_2", calculate(count(Table[Id persona]), filter(Table, table[Id appliance]-15 && table[Id state] ?3))) , [_1] >0 && [_2] >0 ), [Id persona])
2 Replies
- amitchandak
Super User
@Syndicate_Admin , Try a measure like
countx(filter(summarize(TABLE, Table[Id persona], "_1", calculate(count(Table[Id persona]), filter(Table, table[Id appliance]-1 && table[Id state] ?2))
, "_2", calculate(count(Table[Id persona]), filter(Table, table[Id appliance]-15 && table[Id state] ?3))) , [_1] >0 && [_2] >0 ), [Id persona])- Syndicate_Admin
Administrator
Thanks a lot!!! It was just what I needed!!!