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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

[ASK] common AsOfDate script issue

hello..

i found an issue about AsOfDate function

i use AsOfDate to compare result between current day volume and yesterday volume

but it can only get the yesterday result, not the day before yesterday

just like the picture below :

error loading image

A picture i use AsOfDate, but when the date is 09/08/2010 the yesterday volume is 0

the correct one that it must have 06/08/2010 volume

if i use above function, it can't sort by expression

how to make AsOfDate function able to do that?

i mean..i want to AsOfDate able to get the volume just like above function did

i also have attached the file

many thx..

[View:http://community.qlik.com/cfs-file.ashx/__key/CommunityServer.Discussions.Components.Files/11/8524.tes-compare.rar:550:0]

6 Replies
tresesco
MVP
MVP

Hi Kribo,

The probelem is with the script. When you write

LOAD

TRANS_SAHAM_DATE AS AsOfDate,

1 AS YesterdayFlag,

Date(TRANS_SAHAM_DATE-1) AS TRANS_SAHAM_DATE

RESIDENT tbl_trans_saham ;

see then what happens for the date 09/08/2010, AsOfDate as 09/08/2010 but the TRANS_SAHAM_DATE is 08/08/2010 which is not there in the AsOfDate. so the YesterdayFlag does not get any value for that date...So 0 is the output. Therefore you have to change the logic in the script i believe.

Thanks and regards,

tresesco

Not applicable
Author

Hello Tres..

that's the problem, logic of syntax

maybe u have any idea?

i really need an idea for this case

many thx..

tresesco
MVP
MVP

Hi,

Try this,

LOAD

TRANS_SAHAM_DATE AS AsOfDate,

1 AS YesterdayFlag,

peek(TRANS_SAHAM_DATE) AS TRANS_SAHAM_DATE

RESIDENT tbl_trans_saham;

I think this would help you.

...tresesco

Not applicable
Author

hello tres..

the peek doesn't work

it give the same number for yesterday

tresesco
MVP
MVP

This because of renaming.

write it as - peek(TRANS_SAHAM_DATE) as PreTransDate

then recursive reference problem would not be there.

Not applicable
Author

hello tres..

when i did with this syntax :

peek(TRANS_SAHAM_DATE) as TRANS_SAHAM_DATE

then the result show like pic below :

when i'm using this syntax : peek(TRANS_SAHAM_DATE) as pre_TRANS_SAHAM_DATE

then the result is :

FYI, the yesterday volume syntax is :

=SUM({<Date=,YesterdayFlag={1}>} TRANS_SAHAM_VOLUME)

i'm kinda stuck
😞