Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
amien
Specialist
Specialist

bar chart with comparison with same day last year

Thanks to Stephan i used this calendar to calculate the same day of last year ... in other words :

i want NOT to compare 1-1-2015 with 1-1-2014 but with 2-1-2014 (both on the same working day)

Qlik Tips: More on Same Day Last Year

This all works fine, but now i'm looking for a way to present that data.

LOAD * INLINE [
     Date, Value
     1-1-2015 , 100
     1-2-2015 , 150
     2-1-2014 , 200
     2-2-2014 , 250
     3-1-2013 , 50
     31-12-2015, 10
];

So on the 1-1-2015 dimension, i would like to see 100-200 = -100

Because of the current model my expression would need to look something like this:

SUM({<Year = {2015},Date>} Value)-SUM({<Year = {2014},Date>} Value)


My question is, based on the above calendar script and the expression, how would i create a proper dimension for this?


Thanks in advanced

5 Replies
avinashelite

can you elaborate your requirements

sat_tok52
Creator
Creator

Hi,

Test:

LOAD * INLINE [

     Date, Value

     1-1-2015 , 100

     1-2-2015 , 150

     2-1-2014 , 200

     2-2-2014 , 250

     3-1-2013 , 50

     31-12-2015, 10

];


Load

Date,

Year(Date) As Year,

Value

Resident Test


Drop Table Test;


-Sateesh

amien
Specialist
Specialist
Author

I have a bar chart with this:

dimension : period (jan,feb,mar etc)

expressions : SUM({<Year = {2015},Date>} Value)-SUM({<Year = {2014},Date>} Value)

This works fine .. i will compare each period with previous year. Because the dimension is the same in both years (jan or 01) it will be no problem.

But now i want to compare days

What i could do i create a field which will contain the days : 1-1, 1-2, 1-3

in this way, i can compare on the 1-1 dimension : 2014-01-01 and 2015-01-01 with the above set analysis

But the thing is .. 2014-01-01 and 2015-01-01 is not really the same days. one can be on a sunday, the other one on a monday. This can be solved by the script of Stephen.

But how can i put this in a dimension? Because i dont want to see 1-1 in my dimension, but also with a year.

So the enduser will see a 2015-01-01 in the dimension. The expressions with contain : SUM({<Year = {2015},Date>} Value)-SUM({<Year = {2014},Date>} Value). And for 2015-01-01 it will show the value difference between 2014-01-02 and 2015-01-01

amien
Specialist
Specialist
Author

sat.tok52thanks for your reply. But this is not quite what i mean. Please read my comment on Avinashelite

Not applicable

Same Date Comparison CY (Current Year) x Last Year (LY)

I have solved part of this problem, see if this tread helps you.