QlikTip #24: Using line-styles in Line-Charts to differentiate between actual and planning figures

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:

The result: Different line-styles within a single chart

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>') 

Attribute expressions for setting the line-style

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>.

Note:
It is really worth having a look at the chapter “Line Style” or in general “Attribute expressions” in the QlikView Reference Manual.

Bookmark and Share

and tagged , , , . Bookmark the permalink. Both comments and trackbacks are currently closed.

One Comment

  1. Marina Adjieva
    Posted December 29, 2012 at 14:06 | Permalink

    =if(IsForecast = -1, ”, ”)
    a small discrepancy in the text
    IsForecast = 1
    thanks for the article, the information was useful

One Trackback

  1. […] Possibly related posts:QlikTip #24: Using line-styles in Line-Charts to differentiate between actual and planning figures […]