Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Sum and Percentage Diff Between Two Max Dates Within Range

Hello Qlik Community,

In a nutshell I have 5 week ending dates as a dimension. From these 5 week ending dates (Friday) I want to select the latest 2 within the range and calculate the sum difference between them and also the percentage difference as two separate KPI's.

I've had a look online at other topics but I'm finding it difficult to apply the logic to my specific example.

Thanks for any help

2 Replies
dan_sullivan
Creator II
Creator II

depending on how your data model looks, you should look into using FirstSortedValue to help identify the two dates that you need.

Alternatively you could create a rank variable, then reference the rank variable in set analysis to isolate each one.

Anonymous
Not applicable
Author

Hi Dan

Just an update on what I managed to do.

LET vLW = floor(now()-num(weekday(now())))-3;

LET vLWW = floor(now()-num(weekday(now())))-10;

LET vLWWW = floor(now()-num(weekday(now())))-17;

LET vLWWWW = floor(now()-num(weekday(now())))-24;

LET vLYW = floor(addyears(now(),-1))-num(weekday(addyears(now(),-1)))-3;

The above should get to the last 4 weeks worth of week ending dates and also the latest weeks last year equivalent.