Forum Discussion
Anonymous
8 years agoNot applicable
DAX formula for consecutive wins
I am trying to create a measure that will calculate a person's consecutive wins from the data below (this is in a table called Results with the columns as detailed in the picture below: The...
- 8 years ago
Anonymous
This approach will hopefull work
First Add a calculated column like this.
The purpose of this column is to identify the number of consecutive wins at each win
Consecutive Wins = VAR Ref_Date = CALCULATE ( MIN ( Table1[Tournament] ), FILTER ( Table1, [Player] = EARLIER ( [Player] ) && [Tournament] > EARLIER ( [Tournament] ) && LEFT ( [Result], 3 ) <> "1st" ) ) VAR Ref = IF ( Ref_Date = BLANK (), DATE ( 3000, 12, 31 ), Ref_Date ) RETURN IF ( LEFT ( [Result], 3 ) = "1st", COUNTROWS ( FILTER ( Table1, [Player] = EARLIER ( [Player] ) && [Tournament] >= EARLIER ( [Tournament] ) && [Tournament] < Ref ) ) )
Zubair_Muhammad
Community Champion
8 years agoAnonymous
This approach will hopefull work
First Add a calculated column like this.
The purpose of this column is to identify the number of consecutive wins at each win
Consecutive Wins =
VAR Ref_Date =
CALCULATE (
MIN ( Table1[Tournament] ),
FILTER (
Table1,
[Player] = EARLIER ( [Player] )
&& [Tournament] > EARLIER ( [Tournament] )
&& LEFT ( [Result], 3 ) <> "1st"
)
)
VAR Ref =
IF ( Ref_Date = BLANK (), DATE ( 3000, 12, 31 ), Ref_Date )
RETURN
IF (
LEFT ( [Result], 3 ) = "1st",
COUNTROWS (
FILTER (
Table1,
[Player] = EARLIER ( [Player] )
&& [Tournament] >= EARLIER ( [Tournament] )
&& [Tournament] < Ref
)
)
)
- Zubair_Muhammad8 years ago
Community Champion
Anonymous
Now in a Table Visual you can easily select MAX of consecutive WINS
Please see attached file