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

Curve chart in qlikview

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

1 Solution

Accepted Solutions
deepakk
Partner - Specialist III
Partner - Specialist III

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

View solution in original post

8 Replies
deepakk
Partner - Specialist III
Partner - Specialist III

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

Not applicable
Author

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

deepakk
Partner - Specialist III
Partner - Specialist III

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

Not applicable
Author

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

deepakk
Partner - Specialist III
Partner - Specialist III

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

Not applicable
Author

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

deepakk
Partner - Specialist III
Partner - Specialist III

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

Not applicable
Author

Thank a lot Deepak !