Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi the community,
My purpose is to display 2 curves in the same chart according .
I have one dimension witch is the date going from january to december(in a monthly basis: 01/01/2011;01/02/2011......01/12/2011). Each curve should represent a specific year, 1 curve for 2011 and 1 curve for 2012.
I tried to display the 2 curves in the same chart using 2 expressions (1 expression for each curve) but the problem is that i have the 1st curve (for 2011) followed by the second curve (for 2012). what i want is to have the 2 curves starting from the same origin (january). see the attached snapshot
How can i solve this problem ??
thank you
Best regards
Hi,
Its a general scenario, even in excel (pivot tables) it will work in the same way.
By adding the dimesion we are breaking the expression into different parts.
I hope you got my point. Also do mark the correct answer so that others can also get help from this post.
Deepak
HI,
The issue is because you are trying to add the date field. Add the month field and you will get the desired output.
Month(Date) as Month
Deepak
Thanks you for the answer Deepak,
But you mean at the load table step in the script editor ? or at the graphic properties step?
regards
hi,
In the load script itself and then add the month as dimension. For testing purpose yu can add it in the graphic properties and check
Deepak
Hi Deepak,
I tried what you said in the load step in the script editor and in the graph i have the message "no data to display".
After troulebshooting, i understood it is because of the formulas used in the expressions.
In fact, for each expression (each represented by 1 curve), i have a "IF" statement as below:
For 1st curve(2011 sales):
if(year(date)=2011), sum(sales))
For 2st curve(2012 sales):
if(year(date)=2012), sum(sales))
I assume that if a load only Month in the editor script QV could not perform the function YEAR() in the "IF" statement.
Now what is your advice to have only the month dimension in the graph and be able to do the "IF" statement depending the year 2011 and 2012.
thank you in advance
HI,
I got your issue.
Create another field
Year(Date) as Year.
Add this to inside the dimension. Now in your dimension there are two field Month and Year. Promote and demote the dimension to get your required result.
And in expression write Sum(Sales). No need for two expression, one will do.
Deepak
Thanks a lot Deepak it worked !!!!
But can you explain me "what is behind the scene".
I want to know how QV makes the difference between values in 2011 and 2012 to display 2 different curves with only one expression ?
thank for all and best regards
Hi,
Its a general scenario, even in excel (pivot tables) it will work in the same way.
By adding the dimesion we are breaking the expression into different parts.
I hope you got my point. Also do mark the correct answer so that others can also get help from this post.
Deepak
Thank a lot Deepak !