Forum Discussion
Getting the previous record values
- Anonymous1 year ago
Hi Anonymous ,
I create a table as you mentioned.
Then I think you can create a new table and here is the DAX code.
NewTable = SUMMARIZE ( 'Table', 'Table'[StoreName], "Latest Score", CALCULATE ( MAX ( 'Table'[Sum of TotalScore] ), 'Table'[FormDate] = MAX ( 'Table'[FormDate] ) ), "Previous Score", CALCULATE ( MAX ( 'Table'[Sum of TotalScore] ), 'Table'[FormDate] = MAXX ( FILTER ( 'Table', 'Table'[StoreName] = EARLIER ( 'Table'[StoreName] ) && 'Table'[FormDate] < MAX ( 'Table'[FormDate] ) ), 'Table'[FormDate] ) ) )Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
I create a table as you mentioned.
Then I think you can create a new table and here is the DAX code.
NewTable =
SUMMARIZE (
'Table',
'Table'[StoreName],
"Latest Score",
CALCULATE (
MAX ( 'Table'[Sum of TotalScore] ),
'Table'[FormDate] = MAX ( 'Table'[FormDate] )
),
"Previous Score",
CALCULATE (
MAX ( 'Table'[Sum of TotalScore] ),
'Table'[FormDate]
= MAXX (
FILTER (
'Table',
'Table'[StoreName] = EARLIER ( 'Table'[StoreName] )
&& 'Table'[FormDate] < MAX ( 'Table'[FormDate] )
),
'Table'[FormDate]
)
)
)
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous1 year agoNot applicable
I have joined the new table with existing table, now it's filteing the previous values aswel. it's worked fine.. thanks for your help.
- Anonymous1 year agoNot applicable
Thanks for your help, my requiremet got littlebit complicated.. these values will change based the year filter selected by the ender user in the slicer.