12 Replies Latest reply: Nov 4, 2015 1:42 PM by Sunny Talwar

# How To Compare Sum(Sales) for two Timestamps

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

• ###### Re: How To Compare Sum(Sales) for two Timestamps

Selected Date: sum([Net Sales])

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

• ###### Re: How To Compare Sum(Sales) for two Timestamps

Gysbert Wassenaar

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

• ###### Re: How To Compare Sum(Sales) for two Timestamps

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

• ###### Re: How To Compare Sum(Sales) for two Timestamps

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

• ###### Re: How To Compare Sum(Sales) for two Timestamps

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

• ###### Re: How To Compare Sum(Sales) for two Timestamps

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)

• ###### Re: How To Compare Sum(Sales) for two Timestamps

Desn't seem to work

• ###### Re: How To Compare Sum(Sales) for two Timestamps

Since today's date expression is not the only one working, can you try this may be:

=Sum({<STAMP_DATE = {"\$(=TimeStamp(Max(STAMP_DATE), 'YYYY MM DD hh:mm:ss TT'))"}>}NET_SALES)

• ###### Re: How To Compare Sum(Sales) for two Timestamps

This:

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)

• ###### Re: How To Compare Sum(Sales) for two Timestamps

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

• ###### Re: How To Compare Sum(Sales) for two Timestamps

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)