Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
tracycrown
Creator III
Creator III

Current vs Last Date

Dear Sir/Madam

I am trying to compare current date (Aug 26) with previous date (Aug 25) to derive the variance but I am unable to get the daa for the previous date (Aug 25) correctly, please help urgently.

Sample Data below :

 

DateItemQuantity
25/8/2016A264
25/8/2016B68
25/8/2016C19
25/8/2016D27
25/8/2016E25
25/8/2016F1
25/8/2016G3
25/8/2016H18
25/8/2016I14
25/8/2016J14
25/8/2016K1
25/8/2016L72
25/8/2016M3
25/8/2016N12
25/8/2016O12
25/8/2016P2
25/8/2016Q16
25/8/2016R4
25/8/2016S2
25/8/2016T14
25/8/2016U23
25/8/2016V3
25/8/2016W11
25/8/2016X12
25/8/2016Y6
25/8/2016Z15
26/8/2016A273
26/8/2016B72
26/8/2016C19
26/8/2016D28
26/8/2016E30
26/8/2016F1
26/8/2016G3
26/8/2016H18
26/8/2016I15
26/8/2016J15
26/8/2016K1
26/8/2016L75
26/8/2016M4
26/8/2016N12
26/8/2016O13
26/8/2016P2
26/8/2016Q17
26/8/2016R5
26/8/2016S2
26/8/2016T15
26/8/2016U24
26/8/2016V3
26/8/2016W12
26/8/2016X16
26/8/2016Y6
26/8/2016Z15
27/8/2016A281
27/8/2016B72
27/8/2016C19
27/8/2016D28
27/8/2016E32
27/8/2016F1
27/8/2016G3
27/8/2016H18
27/8/2016I15
27/8/2016J15
27/8/2016K1
27/8/2016L76
27/8/2016M4
27/8/2016N12
27/8/2016O13
27/8/2016P2
27/8/2016Q17
27/8/2016R5
27/8/2016S2
27/8/2016T16
27/8/2016U24
27/8/2016V3
27/8/2016W12
27/8/2016X16
27/8/2016Y6
27/8/2016Z15

Thank You

Tracy

1 Solution

Accepted Solutions
sunny_talwar

May be you need this?

Sum({<Date = {"$(=Date(Max(Date) - 1))"}>} Quantity)


Capture.PNG

View solution in original post

6 Replies
sunny_talwar

May be you need this?

Sum({<Date = {"$(=Date(Max(Date) - 1))"}>} Quantity)


Capture.PNG

HirisH_V7
Master
Master

Hi,

May be like this,

Using This expression for picking Max Date,

=sum({<Date={"$(=Date(Max(Date)))"}>} Quantity)

Similarly,For Previous Date,

=sum({<Date={"$(=Date(Max(Date)-1))"}>} Quantity)

MaxDate and Previous Date-230639.PNG

HTH,

PFA,

Hirish

HirisH
“Aspire to Inspire before we Expire!”
HirisH_V7
Master
Master

Hi,

Check may be other way using DayNumber,

=sum({<DayNumber={"$(=Max(DayNumber)-1)"}>} Quantity)

HTH,

PFA,

-Hirish

HirisH
“Aspire to Inspire before we Expire!”
effinty2112
Master
Master

Hi Tracy,

                    If a script solution is acceptable then:

Data:

LOAD Date,

     Item,

     Quantity

FROM

[Test-1.xls]

(biff, embedded labels, table is Sheet1$);

Left Join(Data)

LOAD

Date+1 as Date,

Item,

Quantity as [Prev Qty]

Resident Data;

gives the day to day variance for all date >= 19/8/2016. This is for the 27th:

Date Item Sum(Quantity) Sum([Prev Qty]) Variance
708 696 12
27/8/2016A2812738
27/8/2016B72720
27/8/2016C19190
27/8/2016D28280
27/8/2016E32302
27/8/2016F110
27/8/2016G330
27/8/2016H18180
27/8/2016I15150
27/8/2016J15150
27/8/2016K110
27/8/2016L76751
27/8/2016M440
27/8/2016N12120
27/8/2016O13130
27/8/2016P220
27/8/2016Q17170
27/8/2016R550
27/8/2016S220
27/8/2016T16151
27/8/2016U24240
27/8/2016V330
27/8/2016W12120
27/8/2016X16160
27/8/2016Y660
27/8/2016Z15150

Good luck

Andrew

tracycrown
Creator III
Creator III
Author

Dear Andrew

This method is something new to me and it is useful, thank you so much for your kind suggestion.

Many thanks

Tracy

tracycrown
Creator III
Creator III
Author

Dear Hirish V

Your answer is also correct and I really appreciate your kind effort in explaining different ways of writing the script.

Many Thanks

Tracy