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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
peterderrington
Creator II
Creator II

Calculated Dimension?

I'm trying to create a line graph in QlikView to compare data across two years.

I have a dimension (DOA_Month) and an expression (AVG([Total LOS]) which shows me the length of stay across the months however this shows a combination of two years worth of data across the same months.

I can add a list box to pick a specific year (DOA-Year) but ideally i'd like to show both years (2016 and 2017 from the DOA-Year dimension) on the same graph.

I'm sure its easy to do but my brains just not working this morning.

Would i do this with a 'calculated dimension' or somewhere as an expression?

Many thanks in advance.

Labels (1)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Try AVG({<DOA-Year={'2016'}>}[Total LOS])

View solution in original post

11 Replies
amit_saini
Master III
Master III

Hi,

Create 2 Expression one for 16 and other of 17

(AVG{<Year='2016'>([Total LOS])

(AVG{<Year='2017'>([Total LOS])

Thanks,

AS

tresB
Champion III
Champion III

If you have date field, you could try like:

=MonthName([Date])

Else, you could try concatenating fields like:

=Year & ' - ' & Month

peterderrington
Creator II
Creator II
Author

This feels like its almost it however is it not missing an } symbol?

Should the Year option not be DOA-Year?

Thanks for the speedy responce

peterderrington
Creator II
Creator II
Author

Tried:

Avg({<[DOA-Year]='2016'>}([Total LOS]))

which it accepted as an OK Expression however it then just shows 'No data to display' in the graph.

amit_saini
Master III
Master III

(AVG{<DOA-Year='2016'>}([Total LOS])

Yes you are right

Regards,

AS

peterderrington
Creator II
Creator II
Author

So any idea as to why i'm getting the 'No data to display' message then?

amit_saini
Master III
Master III

Can u please share some sample data and what desired output u are looking for/

Thanks,

AS

peterderrington
Creator II
Creator II
Author

Attached are two pictures of the normal data, each with the list box selected for either 2016 or 2017

I have attached an example of the data.

The fields we're looking at are:

Total LOS - 1 till end of NSECH

DOA-Month

DOA-Year

I want a line graph as shown but with the two years shown in different colours on the same graph.

Thanks.

sasikanth
Master
Master

Add One more calculated dimension

If(DOA-Year>2015,DOA-Year)


OR


Add DOA-Year as a dimension and change exp to
AVG({<DOA-Year={'2016','2017'}>}([Total LOS])