Qlik Community

Qlik Sense App Development

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

ryanmdavies7
New Contributor

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
Contributor II

Re: Sum and Percentage Diff Between Two Max Dates Within Range

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.

ryanmdavies7
New Contributor

Re: Sum and Percentage Diff Between Two Max Dates Within Range

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.