SAMEPERIODLASTYEAR Affected by year filter context

Hi,

I want to show the previous year projected value based on the current filter context selected, but the SAMEPERIODLASTYEAR measure is blank.
image

When I unselect the Year slicer, its working ok.
image

Tried this measure and doesn’t seems to work.

Total Projected Amount LY = CALCULATE(SUM(‘Projected Data’[Amount]), ALL(Dates), SAMEPERIODLASTYEAR(‘Dates’[Date]))

EDNA Sample Data.pbix (143.9 KB)

1 Like

@JazZ0003
Thanks for posting your query.

I took a look at your file and I think the measure formula is correct.
The thing is that your fact table (Projected Data) and Date table do not match in terms of the Date column. You have data for 2020 and 2021 in your fact table, but the Date column in the Dates table is from 2021 to 2024. So, the first thing to do is to correct the Date column in the Dates table to be started from 1/1/2020 instead of 1/1/2021.

The other thing is that I noticed you placed the month in the table visualization from your fact table. I highly recommend you to use filters from your Lookup (Dimension) tables. I replaced that column with the MonthName from Dates table and added the Year column to the viz to be more clear.

Below you can see the data for the Current & Previous years.

And by filtering 2021 using the slicer, you’ll receive the following:

image

If you select 2022 in the slicer, you’ll just see the Total Projected Amounts for LY because you don’t have any value for the 2022 year in your fact table.

EDNA Sample Data.pbix (150.0 KB)

Regards,
Hossein

3 Likes

Super clear solution Hossein, nice one! :+1:

1 Like

Thank you sedhosen,

So dumb of me, I didn’t noticed that one.

Thank also for model suggestion.

2 Likes

It’s great to know that you are making progress with your query @JazZ0003 .

Please don’t forget if your question has been answered within the forum it is important to mark your thread as ‘solved’.

We request you to kindly take time to answer the Enterprise DNA Forum User Experience Survey, We hope you’ll give your insights on how we can further improve the Support forum. Thanks!

Hi @JazZ0003, we’ve noticed that no response has been received from you since a few days ago.

We just want to check if you still need further help with this post?

In case there won’t be any activity on it in the next few days, we’ll be tagging this post as Solved.

This is resolved now. You may close this thread.