Forum Discussion
DouweMeer
Impactful Individual
2 years agoRunning total, Mono poly style
So, I have the problem that if you start of with, say, 200 and then per turn have the option to earn some or lose some, randomly at turn, for example, 50 or 67, you may hit rock bottom, lost all your...
- Anonymous2 years ago
Hi DouweMeer
Thanks for the reply from Sahir_Maharaj and Greg_Deckler , please allow me to provide another insight:
Please try this measure:
MEASURE = VAR _currentTurn = MAX ( 'Table'[Turn] ) VAR _vtable = ADDCOLUMNS ( SELECTCOLUMNS ( ALLSELECTED ( 'Table' ), 'Table'[Earn/ Loss], "_Turn", 'Table'[Turn] ), "_CurrentBN", ROUND ( SUMX ( FILTER ( ALLSELECTED ( 'Table' ), [Turn] <= EARLIER ( [_Turn] ) ), 'Table'[Earn/ Loss] ) / 200, 0 ) ) VAR _vtable2 = ADDCOLUMNS ( _vtable, "_previoudN", IF ( MAXX ( FILTER ( _vtable, [_Turn] = EARLIER ( [_Turn] ) - 1 ), [_CurrentBN] ) > [_CurrentBN], 1 ) ) VAR _vtable3 = ADDCOLUMNS ( _vtable2, "Sort", RANKX ( FILTER ( _vtable2, [_previoudN] <> BLANK () ), [_Turn],, ASC ) ) RETURN MAXX ( FILTER ( ADDCOLUMNS ( _vtable3, "_outcome", IF ( 200 + SUMX ( FILTER ( _vtable3, [Sort] = EARLIER ( [Sort] ) && [_Turn] <= EARLIER ( [_Turn] ) ), [Earn/ Loss] ) < 0, 0, 200 + SUMX ( FILTER ( _vtable3, [Sort] = EARLIER ( [Sort] ) && [_Turn] <= EARLIER ( [_Turn] ) ), [Earn/ Loss] ) ) ), _currentTurn = [_Turn] ), [_outcome] )The result is as follow:
Best Regards
Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Community Champion
2 years agoDouweMeer The Earn/Loss being 0 indicates the start of a new run.
- DouweMeer2 years ago
Impactful Individual
No, like with the game, you can also just have a turn without loss or profit. By itself it is insufficient.