Some months ago I was asked how one could change the line style within a “Line Chart” for distinguishing between actual and planning figures.
The desired result:
How can we manage that in QlikView?
First I added a field named
IsForecast in my demo-application to differentiate between actual and planning figures:
LOAD * INLINE [ Customer, Sales, IsForecast, Period CustomerA, 20, 0, 1 CustomerA, 30, 1, 2 CustomerA, 35, 1, 3 CustomerA, 38, 1, 4 CustomerA, 45, 1, 5 CustomerA, 46, 1, 6 CustomerA, 43, 1, 7 CustomerA, 69, 1, 8 ];
As you can see above both, actual and planning figures are stored in the field “Sales”.
Now just create your chart as usually, using “Customer” as dimension and “
sum(Sales)” as expression.
And now the clue:
Go to “Line Styles” in the properties of your expression and add the following expression:
=if(IsForecast = -1, '<S3>', '<S1>')
Just a little explanation:
You can define the line style by using the following options:
- <S1> – continous (default)
- <S2> – dashed
- <S3> – dotted
- <S4> – dashed/dotted
Furthermore you could use the tag <Wn>, where n defines the width of the line, e.g. <W2.5>.
It is really worth having a look at the chapter “Line Style” or in general “Attribute expressions” in the QlikView Reference Manual.