Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Previous day max record

Hi All,

Find the below table and am looking for the solution

DW_LOAD_DATE,  NUM,COUNTER

7/8/2015 11:10:20 AM,1,1

7/8/2015 12:05:11 AM,1,1

7/9/2015 01:15:11 PM,2,3

7/9/2015 02:15:11 PM,2,3

7/10/2015 01:15:11 PM,2,3


From above DW_LAOD_DATE how to fetch only highligheted record.Basically the max time stamp on proevious day.



Kindly help on this


-Jay



1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe like

Set TimeStampFormat = 'M/D/YYYY hh:mm:ss TT';

INPUT:

LOAD * INLINE [

DW_LOAD_DATE,  NUM,COUNTER

7/8/2015 11:10:20 AM,1,1

7/8/2015 12:05:11 AM,1,1

7/9/2015 01:15:11 PM,2,3

7/9/2015 02:15:11 PM,2,3

7/10/2015 01:15:11 PM,2,3

];

RESULT:

FIRST (1)

NOCONCATENATE

LOAD * RESIDENT INPUT

WHERE DW_LOAD_DATE >= Daystart(Today(1)-1) and DW_LOAD_DATE <= Dayend(Today(1)-1)

ORDER BY DW_LOAD_DATE DESC;

DROP TABLE INPUT;

View solution in original post

8 Replies
Gysbert_Wassenaar

See attached example.


talk is cheap, supply exceeds demand
swuehl
MVP
MVP

=Timestamp(max({<DW_LOAD_DATE = {">=$(=daystart(today()-1))<=$(=dayend(today()-1))"}>} DW_LOAD_DATE))

Anonymous
Not applicable
Author

Hi Wassenaar,

Thank you for reply. Actually I need to filter out that particular record in WHERE condition and it will be single record

in the application. Let me know if you need more info

All I want is previous day record

Anonymous
Not applicable
Author

HI Swuhel,

   Thank you for your reply, I need to filter out yesterday's record in script level. I guess I was not clear while posting

-Jay

PrashantSangle

Hi,

try

where FLOOR(DW_LOAD_DATE)=FLOOR(TODAY()-1)

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
swuehl
MVP
MVP

Maybe like

Set TimeStampFormat = 'M/D/YYYY hh:mm:ss TT';

INPUT:

LOAD * INLINE [

DW_LOAD_DATE,  NUM,COUNTER

7/8/2015 11:10:20 AM,1,1

7/8/2015 12:05:11 AM,1,1

7/9/2015 01:15:11 PM,2,3

7/9/2015 02:15:11 PM,2,3

7/10/2015 01:15:11 PM,2,3

];

RESULT:

FIRST (1)

NOCONCATENATE

LOAD * RESIDENT INPUT

WHERE DW_LOAD_DATE >= Daystart(Today(1)-1) and DW_LOAD_DATE <= Dayend(Today(1)-1)

ORDER BY DW_LOAD_DATE DESC;

DROP TABLE INPUT;

Gysbert_Wassenaar

Perhaps like this:

Temp:

LOAD Max(DW_LOAD_DATE) AS MAX

FROM ...source...

WHERE DW_LOAD_DATE < DayStart(Today());

LET vMax = peek('MAX', 'Temp');

DROP TABLE Temp;

Result:

LOAD * FROM ...source...

WHERE DW_LOAD_DATE = $(vMax);


talk is cheap, supply exceeds demand
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this script

Data:

LOAD

Date(Floor(Date#(DW_LOAD_DATE, 'M/D/YYYY hh:mm:ss TT'))) AS Date,

TimeStamp(Timestamp#(DW_LOAD_DATE, 'M/D/YYYY hh:mm:ss TT')) AS DW_LOAD_DATE,

NUM, COUNTER

INLINE [

DW_LOAD_DATE,  NUM,COUNTER

7/8/2015 11:10:20 AM,1,1

7/8/2015 12:05:11 AM,1,1

7/9/2015 01:15:11 PM,2,3

7/9/2015 02:15:11 PM,2,3

7/10/2015 01:15:11 PM,2,3];

INNER JOIN(Data)

LOAD

Date,

Timestamp(Max(DW_LOAD_DATE), 'M/D/YYYY hh:mm:ss TT') AS DW_LOAD_DATE

RESIDENT Data

WHERE Date = Date(Today() - 1)

Group By Date;

Regards,

Jagan.