Forum Discussion
DAX - countif after grouping
- 8 years ago
Hi Celador
Try these MEASURES as well
Red = COUNTROWS ( FILTER ( SUMMARIZE ( Table1, Table1[UserId], Table1[ResponseId], Table1[Result] ), Table1[Result] = "Red" ) )And
Blue = COUNTROWS ( FILTER ( SUMMARIZE ( Table1, Table1[UserId], Table1[ResponseId], Table1[Result] ), Table1[Result] = "Blue" ) )
Yes it will give you 6 and 7 unless you will group them by UserID once grouped it will give you 2 and 3
- Do you know how to use grouping in Power BI?
Abduvali Not really, I have a rough understanding of the SUMMARIZE function - which is what I thought I would need, but not enough to generate the answer I'm after.
Sorry if i wasn't clear in the original post, it's the combination of grouping by those columns, followed by the count that I'm struggling with.
- Abduvali8 years agoSkilled Sharer
See below on how to group your table to get to desired table look:
Group By function in Edit Query Mode
Final Result
Hope this helps.
Regards
Abduvali
- Celador8 years agoFrequent Visitor
Is there no way to write a single measure that will result in the Answer of 3 & 2?
- Abduvali8 years agoSkilled Sharer
You IF statement, create new column:
Column = if(Sheet2[Level] = "red",
CALCULATE(COUNT(Sheet2[level]),Sheet2[Level] = "Red"),
CALCULATE(COUNT(Sheet2[level]),Sheet2[Level] = "Blue")
)