Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
gonzaloyaguesun
New Contributor III

Variable X scale on a combo chart (Qlik Sense)

Dear all,

On the one hand, I have a combo chart displaying Sales and Forecast (measures) for each Week (dimension). Week is an integer ranging from 1 to 40. Sales are visualised as a bar chart and Forecast as a line chart. On the other hand, I have a filter with the number of Weeks.


Firstly, I have to display Forecast  from 1st to 40th week regardless which week is selected on the filter. I have achieved it by typing the following code: Sum({1}Forecast). Secondly, I need to display Sales from the  first week to the maximum value selected on the filter. For example, if I selected either fourth and fith week or just fifth week, Sales should be displayed only for first, second, third, fourth and fifth week.

I would really appreciate if anyone could help me solve this issue. Thank you very much in advance.

Best regards,

Gonzalo

Tags (1)
1 Solution

Accepted Solutions
gonzaloyaguesun
New Contributor III

Re: Variable X scale on a combo chart (Qlik Sense)

Hi Max,

The code is great but, instead of single quotes, double quotes were needed.

The final code is the following one:      =Sum({<Week={">=1<=$(=(Max(Week)))"}>} Sales)


I really appreciate your help. Thank you very much.

Best regards,

Gonzalo

View solution in original post

4 Replies
Highlighted
maxsheva
Contributor II

Re: Variable X scale on a combo chart (Qlik Sense)

Hi Gonzalo,

If first week means beginning of the year you may try this expression

=SUM({<Year={'$(=max(Year))'},Date={'<=$(=(max(Date)))'},Month=,Day=>} Sales)

Month=,Day= needed to ignore selections from such fields

you may simply remove it from expression

Would be nice if you provide feedback.

gonzaloyaguesun
New Contributor III

Re: Variable X scale on a combo chart (Qlik Sense)

Hi Max,

Thank you very much for your help. Unfortunately, Week does not come from a date field so we cannot work with years. It's just a number ranging from 1 to 40.

Just in case, I did not explain properly the issue... Let's imagine we had the following data:

Week      Sales

1             300

2             400

3             250

4             600

5             700

If we selected week on Week 3 on the filter. The combo chart should display the following Sales:

Week      Sales

1             300

2             400

3             250

Thank you very much.

Best regards,

Gonzalo

maxsheva
Contributor II

Re: Variable X scale on a combo chart (Qlik Sense)

Gonzalo,

Please try this

=Sum({<Week={'>=1<=$(=(Max(Week)))'}>} Sales)

gonzaloyaguesun
New Contributor III

Re: Variable X scale on a combo chart (Qlik Sense)

Hi Max,

The code is great but, instead of single quotes, double quotes were needed.

The final code is the following one:      =Sum({<Week={">=1<=$(=(Max(Week)))"}>} Sales)


I really appreciate your help. Thank you very much.

Best regards,

Gonzalo

View solution in original post