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: 
Not applicable

Dynamically change the axes in a chart

I was using this sales vs date chart with Daily Sales on the Y-axis and Dates on X-axis.

At the top, I have filters to choose the start and end dates. But if I set the filters in a way that the date difference between the start and end date in 30+ days, then it becomes cumbersome to read it properly. Is it possible to calculate the difference of selected date & store it in variable and  if variable < 15 days then, show graph_1, if variable >15 & < 30, then show graph_2, else graph_3 where

graph1 - will always shows date wise sales

graph2- weekwise

graph3- monthwise
Please help.

10 Replies
Anonymous
Not applicable
Author

Hi,

You can create a calendar with dimensions: day, week and month. Then you can create 3 charts, each one with sales vs each dimension. And make a show conditional (properties->layout) for them, that

chart 1 -if difference between start and end date <15,

chart 2 -if difference between start and end date >15 and < 30,

chart 3 -if difference between start and end date >30,

Best Regards,

gsbeaton
Luminary Alumni
Luminary Alumni

Hi Ritesh,

As, Mauri said above, a conditional show on your dimensions would work well.

Another option would be to create a drill down group and then let the user decide whether to look at the data in days, weeks months etc??

Good luck

George

Not applicable
Author

Hi Mauri,

Thank you for the prompt response. Here the current dimension is the visit_date ie. the date on which the customer purchased a product. But I want to change it according to the filters applied ie start and end date which themselves don't have a variable assigned to them. That's why I failed to execute what you suggested. Could you throw some more light on how to approach it?

gsbeaton
Luminary Alumni
Luminary Alumni

Hi Ritesh,

Create two variables first:

Let MaxDate = Max(date);

Let MinDate = Min(date);

Then, in the condition for each dimension (ie, your day, week, month dimensions)

Day - $(MaxDate)-$(MinDate)<30

Week - $(MaxDate)-$(MinDate)>30 and $(MaxDate)-$(MinDate)<90

Month - $(MaxDate)-$(MinDate)>90


Syntax and logic may not be quite there, but I hope this gives you enough to get this working for you.

Good luck

George

Anonymous
Not applicable
Author

You could try transform start date and end date into num and compare those differences, I don't know for sure how 15 day and 30 days differences are represented in num form, but you can check those differences in a text box, then put those in the 'if' statements that I suggested.

Or you can try, use the day function and create a logic to compare the differences between days, but I think this way is a bit more difficult because not all the months have 30 days exactly.

gsbeaton
Luminary Alumni
Luminary Alumni

I should add that here I am assuming that your date is a date and not text.  If you are using proper dates, then QlikView will do the date arithmetic for you.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

!Here's a working example of George's suggestion, which I think is the way to go. That is multiple Dimensions in a single chart.

-Rob

Not applicable
Author

thank you. it worked.

Anonymous
Not applicable
Author

Ritesh

Have a look and this post and sample qvw QlikView App: Dynamic Date Dimension by stevedark