# Supperimpose Previous Week's Values on Current Week Visual

How can I superimpose the previous week’s values on the current week?

That is, I wish to have a plot for today’s orders with an overlay chart of last week’s order distribution.

Thanks

Hello @sahil.maisuria - You need to create 2 measures - Current Orders and Previous Week Orders and then put those 2 measures in the Area chart to achieve that. In case, you are facing any challenge, please let me know. If you can share a sample of your dataset, then I can provide you more details on the exact calculation in case you need it. Hope this helps! Thank you!

@sagmukhe How do I create the previous week’s values? My date variable is at the minute level.

Here is my formula for the current week’s orders:
Total Orders = distinct_count({id[table_session]})

I’m not sure if this is correct, however.

Thanks for your response @sahil.maisuria. Having Date variable at minute level is not a problem. However, in which granularity do you want to have your X axis? Because if you want to show the date field (at minute level) in X Axis then what value to you want to put against it. For example - Dec 10 12.00 PM - What do you want to show as Current Value vs Previous Week Value? Will it be just 7 day prior value that you would like to see? A sample of expected layout will be helpful. Thank you!

Hi @sagmukhe. Here is an example of the layout.

I wish to show the current week’s date on the X axis but have the 7 day prior value as a line

There are basically 3 steps that you need to do.

Step 1 : Convert your Date Field into Date Format (if not done already) so that Time calculations can be don over that.

Step 2 : Create Current Orders =

distinct_count({Order ID})

Step 3: Create Previous Orders =

periodOverPeriodLastValue(distinct_count({Order ID}), {Order Date},WEEK, 1)

Step 4 : Project these 2 measures in Line chart like below

Hope this helps!

Did my suggestion help you in resolving your query? If yes, would request you to mark the post as “Solution”. This will help the community to find guidance and answers to similar question. Thank you!

1 Like

@sagmukhe This is really helpful! Thank you so much!

1 Like