Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Conditional Behaviour

My Main Problem which often occurs on different places in the Set Anaylsis Loic is if i need to make a behavior depend on what has selected frm the user, I come into deadend with qlikview.
Example, assume I have a table:

MONTH_ID, Brand, Demand, Forecast
-----------------------------------------------------

20110101, 1000, 20, 55
20110201, 1000, 15, 50
20110301, 1000, 14, 50
20110401, 1000, 11, 45
20110501, 1000, 10, 45
20110601, 1000, 10, 40
20110701, 1000, 10, 45

And user selects MONTH_NAME:  APRIL  YEAR: 2011

In the chart I need following result, before Month 4 list Demand values, after month 4 list forecast values:

MONTH_ID, Brand, Value, mode

--------------------------------------------

20110101, 1000, 20 , 'DEMAND'
20110201, 1000, 15, 'DEMAND'

20110301, 1000, 14, 'DEMAND'

20110401, 1000, 11, 'DEMAND'

20110501, 1000, 45, 'FORECAST'
20110601, 1000, 40, 'FORECAST'
20110701, 1000, 45, 'FORECAST'

The chart I would make is: Dim: Brand, MONTH_NAME

The expression I would make is:

if (MONTH_ID > GetFeldSelection(MONTH_ID)
sum({<MONTH_NAME=,YEAR=>}  Demand, Forecast)

With the abov result I like to make a graph line chart, and the forecast values should appear in dotted lines, if mode='FORECAST' the dotted

1 Solution

Accepted Solutions
swuehl
MVP
MVP

I used your above table (without additional MONTH_NAME, YEAR) and this expression seems to work quite well (using a straight table with dimensions Brand and MONTH_ID):

=if(only({<MONTH_ID= >} MONTH_ID) <= max( total MONTH_ID), sum({<MONTH_ID= >} Demand),sum({<MONTH_ID= >} Forecast))

Hope this helps,

Stefan

View solution in original post

3 Replies
Not applicable
Author

I forgot to say, with the expression I try it does not work, I have always only the selected MONTH_ID, even if I have the: MONTH_ID=

swuehl
MVP
MVP

I used your above table (without additional MONTH_NAME, YEAR) and this expression seems to work quite well (using a straight table with dimensions Brand and MONTH_ID):

=if(only({<MONTH_ID= >} MONTH_ID) <= max( total MONTH_ID), sum({<MONTH_ID= >} Demand),sum({<MONTH_ID= >} Forecast))

Hope this helps,

Stefan

Not applicable
Author

Hi,

Here is a possible solution.

Hope this helps!