Reputation: 53
I want to GROUP BY the "id" column and then get a COUNT for records that equal "yes". I want to write a MEASURE in Power BI.
This is how my data looks :-
I would want to convert it like :-
Then, I want to just COUNT the number of records that equal "yes", like :-
"yes" has 3 DISTINCT records. "no" has 4 DISTINCT records.
I do know that if I remove duplicates and do some things here and there, I can actually get a COUNT for this... But I need those records for other reasons.
Is there any way I can write a MEASURE to achieve this.
Would really appreciate some help :)
Upvotes: 0
Views: 4848
Reputation: 12375
Try this:
Grouped Table =
SUMMARIZE(
YourTable,
YourTable[id],
"status", MAX(YourTable[status])
)
Yes =
CALCULATE(
COUNTROWS('Grouped Table'),
'Grouped Table'[status] = "Yes"
)
No =
CALCULATE(
COUNTROWS('Grouped Table'),
'Grouped Table'[status] = "No"
)
Which looks like
OR: Add another Count Table if you like
Count Table =
SUMMARIZE(
'Grouped Table',
'Grouped Table'[status],
"count", COUNT('Grouped Table'[status])
)
Upvotes: 0