Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
ananyaghosh
Creator III
Creator III

sum({<[Process Date]={"$(=date(max([Process Date])-1,'MM/DD/YYYY'))"}>}[Sales Posting Amount USD]) is working for me

Hi,

I am using the below expression:

sum({<[Process Date]={"$(=date(max([Process Date])-1,'MM/DD/YYYY'))"}>}[Sales Posting Amount USD])

for previous day calculation. But I get 0. Please tell me what wrong in it.

my [Process Date] format is MM/DD/YYYY

I have modified my code and chart functions and have attached it for reference.

Please help me.

23 Replies
ziadm
Specialist
Specialist

make sure that you date format is set as

SET DateFormat='MM/DD/YYYY';

ananyaghosh
Creator III
Creator III
Author

I have set the variables:

SET DateFormat='MM/DD/YYYY';

SET TimestampFormat='MM/DD/YYYY';

but it is not working for me.

Any suggestions?

jonas_rezende
Specialist
Specialist

Hi, Sandip Ghosh.

Try:

sum({<[Process Date]={"=$(date(max([Process Date])-1,'MM/DD/YYYY'))"}>}[Sales Posting Amount USD])


Hope this helps!

Anil_Babu_Samineni

Try with this first

sum({<[Process Date]={'$(=date(max([Process Date]),'MM/DD/YYYY'))'}>}[Sales Posting Amount USD])

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
ananyaghosh
Creator III
Creator III
Author

Hi,

It is not working. Please can you try in a QVW file for practical use.

Thanks,

Sandip

Anonymous
Not applicable

are you sure, you're using dual() dates?!?

if not, try:

sum({<[Process Date]={"$(=date(max(date#([Process Date],'MM/DD/YYYY'))-1,'MM/DD/YYYY'))"}>}[Sales Posting Amount USD])

Anil_Babu_Samineni

For me it is working

Inline memory example i used

LOAD * Inline [

Process Date, Sales

01-01-2017, 10

01-02-2017, 10

01-03-2017, 10

01-04-2017, 10

];

Current month

sum({<[Process Date]={'$(=date(max([Process Date])))'}>}[Sales Posting Amount USD])

Capture.PNG

For Previous Month

Sum({<[Process Date] = {'$(=AddMonths(Date(Max([Process Date])),-1))'}>}Sales)

Capture.PNG

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
ananyaghosh
Creator III
Creator III
Author

Hi,

It seems that it only shows the sales based on  maximum date and it's previous date. But I want to show the sales for each date and beside it , I need to show the previous date's sales.

So I am attaching you the ample data for it.

Anil_Babu_Samineni

I have seen attachment, Can you help me to understand the fields you are talking about

What are these fields on your excel --- [Process Date], [Sales Posting Amount USD]

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful