Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I want to show YTD data current week Vs same week last year, everyone has examples to do it in months.
And how do i display it in a table week per week per row, so we will have 32 rows this week and 33 next week etc.
Thanks
Is this what you looking for?
No replies yet, I'm glad it's harder than i thought.
Hi manraj, if you have a master calendar you can use week number as dimension.
Then you can create two expressions, one for current year and one for last.
Sum({<Year={'$(=Max(Year))', Date={'<=$(=Date(Today()))'}>} Value)
Sum({<Year={'$(=Max(Year)-1)'}, Date={'<=$(=Date(AddYears(Today(), -1)))'}>} Value)
Hi,
Are you using Master Calendar?
I've tried week number as the Dimension, but because i got 2014 in one of the columns, the weeks go down to 52, i want it to stop at current week on the straight table, for example, this week will have 32 rows and my totals will show week 32 2015 totals v week 32 2014 totals.
No
To Create a Master Calendar
LET vCalendarMinDate = Num(MakeDate(2014,1,1)); //Change accordingly with your data
LET vCalendarMaxDate = Num(MakeDate(2014,8,4)); //Change accordingly with your data
Calendar:
LOAD Date,
Year(Date) as Year,
Month(Date) as Month,
Day(Date) as [Day],
Week(Date) as [Week]
//Any other calendar fields you whish to create
;
LOAD
$(vCalendarMinDate)+IterNo()-1 as Date //Shoud be the FieldName in your data
AUTOGENERATE 1
WHILE $(vCalendarMinDate)+IterNo()-1<=$(vCalendarMaxDate);
In Settings->Variable Overview create the fallowing variables
Say the maximum date in the master calendar is 04/08/2015 (DD/MM/YYYY)
vMaxDate =Num(Max(Date)) //Should evaluate to 04/08/2015 (DD/MM/YYYY) = 42220
vYear =Year($(vMaxDate))
vLastYear =Year(AddYears($(vMaxDate), -1))
vMaxWeekSameYear =Week($(vMaxDate)) //Should evaluate to 32
vMaxWeekLastYear =Week(AddYears($(vMaxDate), -1)) //Same as Above
For LYTD (Last YTD)
Sum({<Calendar.Year={$(vLastYear)}, Calendar.Week={"<=$(vMaxWeekLastYear)"}>} Value) //This should accumulate the values up to Week 32 of 2014
For YTD
Sum({<Calendar.Year={$(vYear)}, Calendar.Week={"<=$(vMaxWeekSameYear)"}>} Value) //This should accumulate the values up to Week 32 of 2015
A good data model is designed to support the analysis required by the client. In your case you want to time series analysis. While this can be done without a calendar, it is a lot simpler if you have the requisite calendar fields as required by your users. Usually this is put in a separate master calendar table. There are plenty of links on tjhis site about how to set up a master calendar.
In your case you need a Week field and a Year Field. Then you can use set expressions to select the same week ranges for this year and last year and Week as a dimension in your chart/table:
Define these variables:
Set vMaxWeek = '=Week(Today())';
Set vMaxYear = '=Max(Year)';
Use these expression for CYTD and LYTD by week:
Sum({<Year = {$(=vMaxYear)}, Week = {"<$(=vMaxWeek)"}>} Amount)
Sum({<Year = {$(=vMaxYear - 1)}, Week = {"<$(=vMaxWeek)"}>} Amount)
I've tried that and it gives similar results in a straight table, it's still calculating all 2014 weeks rather than total of how 2014 was at week 32
I want the rows to stop at week 32 and total up only up to week 32 for 2014
Booking Week | 2015 | 2014 |
ytd 2015 | same ytd totals 2014 | |
1 | 2935 | 8284 |
2 | 5307 | 12769 |
3 | 5334 | 11416 |
4 | 4989 | 9789 |
5 | 5397 | 8383 |
6 | 4964 | 5598 |
7 | 4129 | 5329 |
8 | 3474 | 5548 |
9 | 3408 | 5805 |
10 | 3022 | 6581 |
11 | 2707 | 8030 |
12 | 2740 | 6463 |
13 | 2928 | 5121 |
14 | 2807 | 5418 |
15 | 2984 | 6112 |
16 | 3190 | 5825 |
17 | 3070 | 5853 |
18 | 3054 | 5493 |
19 | 2969 | 6058 |
20 | 3466 | 7176 |
21 | 3780 | 6837 |
22 | 3441 | 5972 |
23 | 3780 | 6223 |
24 | 3265 | 6744 |
25 | 3440 | 8048 |
26 | 3420 | 10050 |
27 | 3754 | 6063 |
28 | 3795 | 6972 |
29 | 4125 | 7246 |
30 | 4060 | 8432 |
31 | 3058 | 7468 |
32 | 0 | 4714 |
33 | 0 | 6047 |
34 | 0 | 7590 |
35 | 0 | 7331 |
36 | 0 | 5691 |
37 | 0 | 4868 |
38 | 0 | 4512 |
39 | 0 | 5314 |
40 | 0 | 3980 |
41 | 0 | 3041 |
42 | 0 | 3167 |
43 | 0 | 3375 |
44 | 0 | 3850 |
45 | 0 | 4741 |
46 | 0 | 3737 |
47 | 0 | 3695 |
48 | 0 | 3025 |
49 | 0 | 2938 |
50 | 0 | 3002 |
51 | 0 | 3252 |
52 | 0 | 2987 |