Forum Discussion
Return values for blanks
- 4 years ago
Hi Anonymous ,
According to your description, here's my solution.
1.Create a new table.
Table = GENERATE ( VALUES ( Stats[Date] ), UNION ( ROW ( "Player", "Messi" ), ROW ( "Player", "Ronaldo" ) ) )2.Create a calculated column in the new table.
Goal = IF ( MAXX ( FILTER ( ALL ( 'Stats' ), 'Stats'[Date] = EARLIER ( 'Table'[Date] ) && 'Stats'[Player] = EARLIER ( 'Table'[Player] ) ), 'Stats'[Goals] ) <> BLANK (), MAXX ( FILTER ( ALL ( 'Stats' ), 'Stats'[Date] = EARLIER ( 'Table'[Date] ) && 'Stats'[Player] = EARLIER ( 'Table'[Player] ) ), 'Stats'[Goals] ), 0 )3.Create a measure.
Cumulative goals = SUMX ( FILTER ( ALL ( 'Table' ), 'Table'[Date] <= MAX ( 'Table'[Date] ) && 'Table'[Player] = MAX ( 'Table'[Player] ) ), 'Table'[Goal] )Get the expected result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
According to your description, here's my solution.
1.Create a new table.
Table =
GENERATE (
VALUES ( Stats[Date] ),
UNION ( ROW ( "Player", "Messi" ), ROW ( "Player", "Ronaldo" ) )
)
2.Create a calculated column in the new table.
Goal =
IF (
MAXX (
FILTER (
ALL ( 'Stats' ),
'Stats'[Date] = EARLIER ( 'Table'[Date] )
&& 'Stats'[Player] = EARLIER ( 'Table'[Player] )
),
'Stats'[Goals]
)
<> BLANK (),
MAXX (
FILTER (
ALL ( 'Stats' ),
'Stats'[Date] = EARLIER ( 'Table'[Date] )
&& 'Stats'[Player] = EARLIER ( 'Table'[Player] )
),
'Stats'[Goals]
),
0
)
3.Create a measure.
Cumulative goals =
SUMX (
FILTER (
ALL ( 'Table' ),
'Table'[Date] <= MAX ( 'Table'[Date] )
&& 'Table'[Player] = MAX ( 'Table'[Player] )
),
'Table'[Goal]
)
Get the expected result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous4 years agoNot applicable
v-yanjiang-msft This is great!! Thank you so much!