Combined table of dataset snapshots and comparison year on year

Hello. I have a table where I’m combining (appending) “snapshots” of a dataset.
I’m concatenating ERP data exports every beginning of the month. I’d like to be able to select one of the snapshots and compare the selected dataset with the snapshot taken the year before same day.
Every snapshot has a unique ID (the export date).
I struggle to find a solution with the previous year’s measure.
test2.pbix (93.1 KB)

Here attached a sample pbix file. The measure “Total SnapShot previous year” is wrong.
Could you please help me?
Thanks

Hi @Ferraglia, try this DAX Code

Total SnapShot previous year = 
VAR MaxSnapShot = MAX('Table SnapShoths'[SnapshotTaken on])
VAR Test = DATE( YEAR(MaxSnapShot) - 1, MONTH(MaxSnapShot), DAY(MaxSnapShot))
RETURN
CALCULATE([Total Amount],
    FILTER(
        ALL('Table SnapShoths'),
        'Table SnapShoths'[SnapshotTaken on] = Test
    )    
    )

Hello @jbressan
this code doesn’t fit the needs unfortunately, it was something I already tried out. The problem here is that the ALL function nullifies all the filtering present on the page. As you can see there’s a filter for “Transaction period”, and it doesn’t work as expected anymore. The result of the calculation should be 3, as I mentioned in the picture. Note that the attached model is a simplified version of a bigger model I’m working on, and the filters are many more than that one on the sample page. Hope you can help further. KR

Bumping this post for more visibility.

Hello,
I changed a bit the code and now it seems to work.
Here the .pbix file.
KR
testOK.pbix (132.4 KB)