Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How To Compare Sum(Sales) for two Timestamps

I am struggling to compare Sum(Sales) for two different timestamps. Need help. Thanks,Branislav

Example_StampDate.PNG

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Selected Date: sum([Net Sales])

Previous Date: =sum({<[STAMP_DATE]={"$(=Max({<[STAMP_DATE]={[<$(=Max([STAMP_DATE]))]}>}[STAMP_DATE]))"}>}[Net Sales])


talk is cheap, supply exceeds demand

View solution in original post

11 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Selected Date: sum([Net Sales])

Previous Date: =sum({<[STAMP_DATE]={"$(=Max({<[STAMP_DATE]={[<$(=Max([STAMP_DATE]))]}>}[STAMP_DATE]))"}>}[Net Sales])


talk is cheap, supply exceeds demand
sunny_talwar
MVP
MVP

This:

Capture.PNG

Expressions:

1) =Sum({<STAMP_DATE = {"$(=TimeStamp(Max({1}STAMP_DATE)))"}>}NET_SALES)

2) =Sum({<STAMP_DATE = {"$(=TimeStamp(Max({1}STAMP_DATE, 2)))"}>}NET_SALES)

3) =Column(1) - Column(2)

Not applicable
Author

gwassenaar


Thanks for your quickExample_StampDate_2.PNG reply. Previous Date works great, but selected date gives me sum of all stamp_Dates

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Then you did not select a date. So there does not exist a selected date.


talk is cheap, supply exceeds demand
Not applicable
Author

Sunny:

It seems that it works when calculating Delta, but each column for Current Data_Stamp and Previous Data Stamp is showing 0 even when selected date

Not applicable
Author

when I select a date it's OK, but when nothing is selected it's showing total of all stamps, I would like to show either only the latest stamp or 0 and values are only populated on selection

Not applicable
Author

This is what it looks like. In Scenario 1 I have no dates selected and column 1 is summing all data_stamps, column 2 is taking previous datastamp which is what I am trying to do. The only issue I am having is in Column 1 when nothing is selected I do not want to see sum of all datestamps, as I mentioned earlier, I would like to see the latest only or 0

Example_StampDate_3.PNG

sunny_talwar
MVP
MVP

This will work without any selections:

Expressions

1) =Sum({<STAMP_DATE = {"$(=TimeStamp(Max(STAMP_DATE)))"}>}NET_SALES)

2) =If(Sum({<STAMP_DATE = {"$(=TimeStamp(Max(STAMP_DATE)))"}>}NET_SALES)> 0, Above(Sum({1}NET_SALES)))

3) =Column(1) - Column(2)

sunny_talwar
MVP
MVP

Give try to these expressions:

Expressions

1) =Sum({<STAMP_DATE = {"$(=TimeStamp(Max(STAMP_DATE)))"}>}NET_SALES)

2) =If(Sum({<STAMP_DATE = {"$(=TimeStamp(Max(STAMP_DATE)))"}>}NET_SALES)> 0, Above(Sum({1}NET_SALES)))

3) =Column(1) - Column(2)