Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Display data depending of the year

Hello everyone,

I am using Qlik Sense Desktop and I have a Graph that display data trend from last year to date.

The problem is I would like to have 2 Graphs one on top of each others and comparing Jan 2015 with Jan 2016, Feb 2015 with Feb 2016 and so on... I don't want a dual column comparison.

When I click on my first Graph, I am using the Edit Expression where I will put my function there but after trying many different things, I am starting to have white hair Keep in mind that I am new to Qlik.

Any help will be really appreciated!

Eric

12 Replies
reddys310
Honored Contributor II

Re: Display data depending of the year

Hi Eric,

This is absolutely possible, but not by overlapping visualizations.

When you say year to date you have the months and dates as a common dimension. So you will be able to plot two lines using 3 different measures on the line chart.

Make use of yeartodate() function in the master calendar and set analysis to achieve this.

Thanks,

Sangram.

Not applicable

Re: Display data depending of the year

Yes this is correct, I have one column with the day, Month and year in it (ex: 2/14/2016)

So what you are saying I will need to display the comparison in the same graph with 2 columns depending of the year so lets say Red for 2015 and blue for 2016, is that correct?

I am curious on how this is possible to do even if I use yeartodate() function

Eric

reddys310
Honored Contributor II

Re: Display data depending of the year

Hi Eric,

Check this out first about the master calendar. You can set flags for all the date ranges you need using this. This simplifies your calculations in hte front end and also improves performance.

Creating A Master Calendar

Once done you can use those flag to plot a line chart something like this:

Capture.PNG

Thanks and Regards,

Sangram Reddy.

Not applicable

Re: Display data depending of the year

OK I see but this is not done in Qlik Sense Desktop but in Qlik View Desktop. From what I understand this is completely different right?

Eric

Not applicable

Re: Display data depending of the year

Is there anything like this:

sum(if(date(year) > '2016',[$Rev]))

Where if the date year is over 2016, display the revenue.

Thanks

Eric

reddys310
Honored Contributor II

Re: Display data depending of the year

Hi Erric,

The image is from QlikSense. And yes you need to addapt a different approach for this.

Thanks,

Sangram.

reddys310
Honored Contributor II

Re: Display data depending of the year

Yes you can do it, you will have to use set analysis for that:

sum({< Year = {'2016'} >}[$Rev]) - this sum the data only for 2016

sum({< Year = {'2015'} >}[$Rev]) - this sum the data only for 2015


Now both of these can be used as measures to be plotted in the line chart


Thanks,

Sangram Reddy.

Not applicable

Re: Display data depending of the year

Can you explain the code in bold? sum({< Year = {'2016'} >}[$Rev])

The code is OK (no error) but my graph shows nothing. Where does the code look into my column date to do his search and return the revenue for 2016?

Thanks a lot for your help

Eric

reddys310
Honored Contributor II

Re: Display data depending of the year

Hi Eric,

{< ... >} - > these brackets are used for set analysis.

{< Year = {'2016'} >}  or  {< Year = {2016} >} ....will default the selection to the year 2016.

So make sure u have a year column with the value 2016 as a text field (if its a text field use the first syntax) or a number.

Also check this out:

A Primer on Set Analysis

this will explain everything you need.

Thanks,

Sangram.

.

Community Browser