Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Week comparison

Hey guys,

how could I make a week comparison in a line / bar chart by selecting two or more specific weeks?

Many thanks

2 Replies
jaimeaguilar
Partner - Specialist II
Partner - Specialist II

Hi,

without using set analysis you can make week comparisons, for example per year. All you have to do is selecting week and year as dimensions. This can give you an easy way to compare weeks that will be displayed depending on your selection.

The problem with this approach is that if for example you need to see week for current month compared to weeks for past month it would not be possible if your selection is July 2014, because your selection will be narrowed to just weeks that belong to current month (july).

For cases like that, you need to use set analysis and fix some selection or ranges of data like this:

sum({$<Year=,Month=,Date=,Week={'week(today())','week(today()-7)','week(Today()-14)','Week(today()-21)'}>}Sales)

This sample expression will return you the sales for current week and week-1, week-2 and week-3. It is important to ignore some field selections that could affect your result (for example here I ignore Year, Month and Date, supposing that those filters are available to users and that they can potentially affect my calculation). Another example would be to have separate columns for every week so I can see the comparison of the last 4 weeks,

regards

martynlloyd
Partner - Creator III
Partner - Creator III

Another option would be to create a week number field in your script using

Year(MyDate) & Week(MyDate) as MyWeekNumber

And then use that as your dimension.

Regards

Marty.