Last x Weeks compared to same periods PY

Hi there,

I am intellectually breaking off my fingernails with this challenge I’m up to:
I have order data that I wish to see for the past, let’s say 5 weeks and compare these to the corresponding values of the same weeks from previous year(s).

So, basically what I want is:

Net Revenue for … :

Wk51/2023 Wk52/2023 Wk01/2024 Wk02/2024 Wk03/2024 as CY line (or columns)
Wk51/2022 Wk52/2022 Wk01/2023 Wk02/2023 Wk03/2023 as PY line (or columns)

Seems so easy - but I won’t get it. Can anyone please help me?

1 Like

Hello @FelixPlatora, I completely understand your frustrations and I hope I can be of assistance. I actually am helping another user through a very similar situation where they are trying to show the comparison between data from 2 different years on a line graph where they are side by side, rather than one after the other. I’ll link that topic here in case it provides some information that will help you understand how we need to craft this solution.

Basically, you will want to use some sort of string naming convention that will allow us to group the dates so they will show as something like “This Year” and “Last Year”. Then, we can use the addDateTime function to convert our previous year’s data to this year. Then both of those metrics can be charted over the same 5 week period, and the string field value will display them on separate lines in the visual. Let me know if you have any specific follow-up questions on implementing this with your data, but I hope this helps get you started!

Could not periodOverPeriodLastValue - Amazon QuickSight work for this use case? On a daily-basis i wouldn’t use it, there are problems if the exact day is not there in a month but on a weekly basis it should work and show you the last weeks.
image
Here with a filter for the last n weeks.
BR
Robert

Seems to be a great idea, and it works really cool for months:
image

For reasons I don’t understand, however, after picking the aggregation “WEEK” for order_week on the X Axis, last year’s values vanish…:
image

Hi Dylan,
thanks for your reply. I tried this but it doesn’t get any better than this:

image

That’s probably not because of your tipp, but because I don’t fully get what you’re actually suggesting, so I’m obviously using it in the wrong manner. Thanks though.

Did you useds for period MONTH in the calculation? this maybe a problem.
If you want to skip between weeks and month i would create two overlaying visuals that you can control with a parameter. Its annoying to maintain but should work properly.

Hey Robert, not that I knew of - but as the result is unsatisfactory, I probably have!? Or maybe that is somewhere done in the data lake, already? At least it seems I have to live this not working…
Anyways, thanks you for your help, though!

Now I think I know what you mean. No, I have used YEAR, because I want the previous year’s value for the specific week…: periodOverPeriodLastValue(sum({net_revenue_euro}), {order_date},YEAR, 1)

Tried WEEK instead, that works in a way - but is showing the WoW numbers, which is not what I want:

image

OK so you want YoY on a weekly granularity?
You could try: periodOverPeriodLastValue(sum({net_revenue_euro}), {order_date},WEEK, 52)
That Should do it.

3 Likes

Woooohoooo! Thanks a ton Robert, you made my day!!

:bouquet:

1 Like