Qlik Community

Ask a Question

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
April 22, 2PM EST: Learn about GeoOperations in Qlik Sense SaaS READ MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
joeybird
Creator III
Creator III

Year / minus year qlik sense

Hi

have the expression

as one line on a chart

count(distinct{< CalendarYear = {"$(=max(CalendarYear))"}>} [Custid])    'Current Year'

and this on a second line on a chart

count(distinct{< CalendarYear = {"$(=max(CalendarYear)-1)"}>} Custid) 'Previous year'

When i pick from a filter pane CalendarYear  e.g 2015

current year line appears, but previous year turns to 0, when there is 10 years worth of data

how can i please amend the set analysis to avoid this

kind regards

1 Solution

Accepted Solutions
Not applicable

I am going to guess that the "Calendar Year" you use in the filter, is the same one you use in the Set Analysis.

That means when you select 2015 in the filter, it limits your data set to only be CalendarYear = 2015. Your Set Analysis will therefore not return anything for 2014, 2013.

You could create a standalone filter list, in the load script, from CalendarYear, calling it something that ensures it will not automatically link to a field e.g. "MyFilterYear"

Then use that dimension as your filter, changing your Set Analysis to use MAX(MyFilterYear)

View solution in original post

8 Replies
sunny_talwar

Are you making the selection just the the CalendarYear field or are there other calendar related fields where you are making selections?

joeybird
Creator III
Creator III
Author

Hi

just the CalendarYear field as a filter pane

please help

sunny_talwar

Would you be able to share screenshots of with and without selection?

joeybird
Creator III
Creator III
Author

Hi

no really but

Date is main field of order data

this links to a calendar table, where it links to date, and then to a column called CalendarYear, and column  CalendarMonth ect.

the same happens on a pivot chart too.

please help

sunny_talwar

I don't see anything wrong with the expression you have posted. Unless you can share a sample or screenshot, not sure if I can provide any advice.

joeybird
Creator III
Creator III
Author

Hi

i basically have a pivot table (Same for line chart ) that as Months on left hand side... and three columns on the right

Current year, Year -1, and Year-2

i want if someone picks from the filter pane a calendar year 2015

current year becomes 2015, Year -1 shows 2014, and year -2 shows 2013

Please help

Not applicable

I am going to guess that the "Calendar Year" you use in the filter, is the same one you use in the Set Analysis.

That means when you select 2015 in the filter, it limits your data set to only be CalendarYear = 2015. Your Set Analysis will therefore not return anything for 2014, 2013.

You could create a standalone filter list, in the load script, from CalendarYear, calling it something that ensures it will not automatically link to a field e.g. "MyFilterYear"

Then use that dimension as your filter, changing your Set Analysis to use MAX(MyFilterYear)

View solution in original post

joeybird
Creator III
Creator III
Author

Hi

thank you team