Qlik Community

App Development

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

Announcements
Join “Do More With Qlik” with Mike Tarallo to get a first-hand look at the New Authoring Experience, June 29th: REGISTER HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
LukeCraven36
Contributor
Contributor

Comparing Values Between Multiple Dates

Good day Qlik Experts,

This is my very first post to the Community .. I imagine there will be many more as I progress with Qlik Sense.

I'm using the following set analysis to compare week on week (or day on day) values:

(sum([Sales (£)])
-
sum( {< [Date] = {"$(=Date((Date)-7,'DD/MM/YYYY'))"} >} [Sales (£)]))

This works perfectly when selecting just one date

Qlik Working KPI.JPG

 

 

 

 

However, if I select multiple dates, then the set analysis fails.

Qlik Not Working KPI.JPG

 

 

 

 

I need your help .. how can I have the week on week work when I select multiple dates?

Thanks in advance

2 Replies
TimvB
Creator II
Creator II

Hi, welcome to the Qlik Community!

In case you select multiple dates, your set analysis expression does not know from which date to substract one week (7 days). Therefore, you should specify a single date in the set analysis, for example, the minimum date of the selected dates. In this case, the expression is:

sum([Sales (£)])
-
sum({< [Date] = {"$(=Date(Min(Date)-7,'DD/MM/YYYY'))"} >} [Sales (£)])

I would recommend to visualize the "current day" and "previous day" somewhere on the dashboard so that users do not get confused. This can for example be done in a text object or just as a subtitle or footnote of the KPI.

Hope it helps!

 

LukeCraven36
Contributor
Contributor
Author

Hi Tim,

Thank you for help/reply .. really appreciate it. So, if I give you an example, could you tell me if this would work. Previously, I did have MAX (where you’ve added MIN)  and although the KPI showed a value, it wouldn’t reflect what I was after. For example (using MAX):

I’d select Sun 23/02/2020 and it would compare it to Sun 16/02/2020 .. a week on week comparison of Sunday. Great. However if I select 23/02 and 22/02 then this is where it fails. I’d be comparing the Sat and Sun (current week) to only Sun (previous week) as it would be searching for my MAX value only in the current week. 

It’s asking Qlik to compare multiple dates in the previous week if selected. 

Hope this makes sense?