Qlikview line chart with multiple expressions over time period dimension

8.2k views Asked by At

I am new to Qlikview and after several failed attempts I have to ask for some guidance regarding charts in Qlikview. I want to create Line chart which will have:

One dimension – time period of one month broke down by days in it

One expression – Number of created tasks per day

Second expression – Number of closed tasks per day

Third expression – Number of open tasks per day

This is very basic example and I couldn’t find solution for this, and to be honest I think I don’t understand how I should setup my time period dimension and expression. Each time when I try to introduce more then one expression things go south. Maybe its because I have multiple dates or my dimension is wrong.

Here is my simple data:

http://pastebin.com/Lv0CFQPm

I have been reading about helper tables like Master Callendar or “Date Island” but I couldn’t grasp it. I have tried to follow guide from here: https://community.qlik.com/docs/DOC-8642 but that only worked for one date (for me at least).

How should I setup dimension and expression on my chart, so I can count the ID field if Created Date matches one from dimension and Status is appropriate?

I have personal edition so I am unable to open qwv files from other authors.

Thank you in advance, kind regards!

1

There are 1 answers

3
The Budac On BEST ANSWER

My solution to this would be to change from a single line per Call with associated dates to a concatenated list of Call Events with a single date each. i.e. each Call will have a creation event and a resolution event. This is how I achieve that. (I turned your data into a spreadsheet but the concept is the same for any data source.)

Calls:
LOAD Type, 
     Id, 
     Priority, 
     'New' as Status,
     date(floor(Created)) as [Date],
     time(Created) as [Time]
FROM
[Calls.xlsx]
(ooxml, embedded labels, table is Sheet1) where Created>0;

LOAD Type, 
     Id, 
     Priority, 
     Status,  
     date(floor(Resolved)) as [Date],
     time(Resolved) as [Time]
FROM
[Calls.xlsx]
(ooxml, embedded labels, table is Sheet1) where Resolved>0;

Key concepts here are allowing QlikView's auto-conatenate to do it's job by making the field-names of both load statements exactly the same, including capitalisation. The second is splitting the timestamp into a Date and a time. This allows you to have a dimension of Date only and group the events for the day. (In big data sets the resource saving is also significant.) The third is creating the dummy 'New' status for each event on the day of it's creation date.

With just this data and these expressions

Created = count(if(Status='New',Id))
Resolved = count(if(Status='Resolved',Id))

and then

Created-Resolved

all with full accumulation ticked for Open (to give you a running total rather than a daily total which might go negative and look odd) you could draw this graph.

Calls Opened, Closed and Open Total

For extra completeness you could add this to the code section to fill up your dates and create the Master Calendar you spoke of. There are many other ways of achieving this

MINMAX:
load floor(num(min([Date]))) as MINTRANS,
floor(num(max([Date]))) as MAXTRANS
Resident Calls;

let zDateMin=FieldValue('MINTRANS',1);
let zDateMax=FieldValue('MAXTRANS',1);

//complete calendar
Dates:
LOAD
    Date($(zDateMin) + IterNo() - 1, '$(DateFormat)') as [Date]
AUTOGENERATE 1
WHILE $(zDateMin)+IterNo()-1<= $(zDateMax);

Then you could draw this chart. Don't forget to turn Suppress Zero Values on the Presentation tab off. Complete Calendar version

But my suggestion would be to use a combo rather than line chart so that the calls per day are shown as discrete buckets (Bars) but the running total of Open calls is a line

Combo Chart