I want to count the wins from the dataset below. The stage Fin refers to finals and there are 7 games in each final, so the games 1-5 in 1991 finals and 1-6 in 1992 is final games for that period, and I need to find if the team has won more than or equal to 4 times out of those games played. Result gives me the status Win (W) and Loss (L).
So ideally, in 1991 team has lost game 1 and won other 4 games (2-5), so that gives me count 1 and so on.
My stage also consists of other games (Qtrfin, EC1, EC2) as well, but I’m concerned about the Fin stage.
LOL. @jbressan, @Melissa and I all must have jumped on this one at close to the same time. For the sake of completeness, here’s another solution - most of the work is done by the Power Query GROUP BY function, then this DAX measure at the end to tally the card:
Count Series Wins =
VAR vTable =
SUMMARIZE(
'Table',
'Table'[Year],
'Table'[Series Outcome]
)
VAR Result =
CALCULATE(
COUNTROWS( vTable ),
FILTER( vTable, 'Table'[Series Outcome] = "W")
)
RETURN Result
I hope this is helpful. Full solution file attached.
Hi @jbressan, @Melissa , @BrianJ
You guys are awesome. There is only one place on earth where you can expect quick solutions and that too not 1 or 2 but many more.
Best approach for me is what Melissa has shared. But, I would love to mark all three posts as a solution.
@EnterpriseDNA team, please add a functionality to mark multiple posts as a solution.
That’s a beautiful piece of DAX coding. One question – any particular reason you used GENERATE (VALUES)) rather than SUMMARIZE? I always tend to use the latter, but I’ve noticed recently you using the former a lot more and wondered if there’s a tangible difference and benefit to doing so?
That is usually my default approach, something similair to what @BrianJ shared.
But finally decided to go with a 100% DAX solution, using PQ result just for validation.
It is a really nice thought, but all’s well that ends well. It was a really interesting question, and I actually used it as the basis for a video coming out next week, plus I got to dig back into the 1990s Chicago Bulls data…