Forum Discussion
Anonymous
1 year agoNot applicable
Getting the previous record values
StoreName FormDate Sum of TotalScore A 09-11-2022 00:00 2 A 05-05-2023 00:00 95 A 16-11-2023 00:00 99 A 23-04-2024 00:00 98 A 19-11-2024 00:00 96 B 02-11-2022 00:00 ...
- 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.
ChielFaber
1 year agoSuper User
The easiest way would probably to use the previous function. Check out visual calculations and the previous function
Using visual calculations in Power BI Desktop - Power BI | Microsoft Learn
A superb overview by Jeroen ter Heerdt:
Visual Calculations In Power BI
Hope this helps.