SAMEPERIODLASTYEAR with slicer Month & Year

Hi,
I have used the data of the example from the course “Ultimate Beginners Guide to DAX” and I have tried the calculation of the Sales data considering the Same period last year. When doing that, I have been testing if it could be possible to create an slicer based on the column Dates[Month & Year] and when using this filter, the result is not the one expected as you can see in this screenshot:

I have a similar issue with a dashboard that I´m creating as the data in that dashboar is only in monthly buckets, rather than in daily buckets as in this example.

Attached you have the data for your consideration.

Is there any way of doing what I´m trying to do without using the column Dates[Date] as in my dashboard I do not have anything like that?

I have tried many things, but I have not been able to find a solution.

As a solution, I have thought about creating another column in the table and with Power Query M try to calculate the previous year data, but it is very difficult to do it due to the level of detail that I have in the data brought to that dashboard.

Thank you very much for your help beforehand!

UBG to DAX - Model.pbix (500.3 KB)

Hi @JosebaDZN

Here its working as expected. You need to understand when the CALCULATE overwrites and when does not overwrite the previous filter context.

First table Year and Month are hierarchies from Date filed, you are using same Date filed in filter context in calculate.

In this case Calculate overwrites the previous filter coming from Table.

Second table Year and Month are separate fields.

UBG to DAX - Model.pbix (500.5 KB)

Hi @JosebaDZN , did the response provided by @Rajesh help you solve your query? If not, how far did you get and what kind of help you need further? If yes, kindly mark as solution the answer that solved your query.

We’ve recently launched the Enterprise DNA Forum User Experience Survey, please feel free to answer it and give your insights on how we can further improve the Support forum. Thanks!

Hi @JosebaDZN, we’ve noticed that no response has been received from you since the 19th of March. 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.

Hi @JosebaDZN, due to inactivity, a response on this post has been tagged as “Solution”. If you have a follow question or concern related to this topic, please remove the Solution tag first by clicking the three dots beside Reply and then untick the check box.

We’ve recently launched the Enterprise DNA Forum User Experience Survey, please feel free to answer it and give your insights on how we can further improve the Support forum. Thanks!