Forum Discussion
Calculated Column: Consecutive Wins Column
- 6 years ago
Hi paulvans182 ,
I find that!😉 Please try this:
Consecutive Wins = VAR Ref_Game_ID = CALCULATE ( MAX ( 'Game Data'[Game ID] ), FILTER ( 'Game Data', 'Game Data'[Player] = EARLIER ( 'Game Data'[Player] ) && 'Game Data'[Game ID] < EARLIER ( 'Game Data'[Game ID] ) && 'Game Data'[Results] <> "W" ) ) VAR Ref = IF ( Ref_Game_ID = BLANK (), 'Game Data'[Game ID] - 1, Ref_Game_ID ) RETURN IF ( 'Game Data'[Results] = "W", DIVIDE ( COUNTROWS ( FILTER ( 'Game Data', 'Game Data'[Player] = EARLIER ( 'Game Data'[Player] ) && 'Game Data'[Game ID] <= EARLIER ( 'Game Data'[Game ID] ) && 'Game Data'[Game ID] > Ref ) ), DISTINCTCOUNT ( 'Game Data'[Category] ) ) )Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi paulvans182 ,
Try this:
Consecutive Wins Measure =
VAR Ref_Game_ID =
CALCULATE(
MIN('Game Data'[Game ID]),
FILTER(
'Game Data',
'Game Data'[Player] = MAX('Game Data'[Player])
&& 'Game Data'[Game ID] > MAX('Game Data'[Game ID])
&& 'Game Data'[Results] = "W"
)
)
VAR Ref =
IF(Ref_Game_ID = BLANK(),1000,Ref_Game_ID)
Return
If(
MAX('Game Data'[Results]) = "W",
CALCULATE(
DISTINCTCOUNT('Game Data'[Results]),
FILTER('Game Data',
'Game Data'[Player] = MAX('Game Data'[Player])
&& 'Game Data'[Game ID] >= MAX('Game Data'[Game ID])
// && 'Game Data'[Game ID] < Ref
)
)
)This is a measure, not a calculated column.
If it doesn't work, please share me more sample data.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Good morning,
Thank you so much for your response but unfortunately, this does not appear to work. All the results are just equal to 1.
I have uploaded the pbix and raw xlsm file here for you to see. Please let me know whether you can access it?
https://www.dropbox.com/s/4m602pufxae34oj/7%20Wonders.pbix?dl=0
https://www.dropbox.com/s/f2lit0kylfnp2ur/7%20Wonders.xlsm?dl=0
Thanks again for your help with this matter.
Kind regards,
Paul