Forum Discussion
Celador
8 years agoFrequent Visitor
DAX - countif after grouping
Hi, I need a series of measures to group some results by two columns and then count specific results in the 3rd column - and I'm very very new to Power BI and DAX. I've done a bunch of googling, re...
- 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" ) )
Abduvali
Skilled Sharer
8 years agoCreate new column with IF statement in it:
Column =
if(Sheet2[Level] = "red",
CALCULATE(COUNT(Sheet2[level]),Sheet2[Level] = "Red"),
CALCULATE(COUNT(Sheet2[level]),Sheet2[Level] = "Blue")
)
Regards
Abduvali
Zubair_Muhammad
Community Champion
8 years agoHi 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"
)
)- Zubair_Muhammad8 years ago
Community Champion
Hi Celador
Just for knowledge sharing. Another way of doing this
Blue = COUNTROWS ( FILTER ( ALL ( Table1[UserId], Table1[ResponseId], Table1[Result] ), Table1[Result] = "Blue" ) )Similar way for Red
- Celador8 years agoFrequent Visitor
Hi Zubair_Muhammad - this is what I was after, I've put it in place and it is working as expected - thank you kindly.
Abduvali - really appreciate your time & you did show me a few things, it just wasn't quite what I was after, but I do appreciate it.
- Celador8 years agoFrequent Visitor
Thanks Zubair_Muhammad - is there any significant performance cost difference between the two solutions?