Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Bharathi09
Creator II
Creator II

Qlik to Snowflake logic

Hi All,

I am working on replicating qlik logic in snowflake, need help on below code WHERE Condition

Parts:
LOAD Distinct
[IDate],
cntnr,
orgn

FROM
[$(vQVDPath)Parts_Transformed.qvd]
(qvd)
where Match(orgn,'US','CA','MX');
store Parts into $(vQVDPath)Part.qvd;

NoConcatenate
Parts_MaxDate:
LOAD Distinct
[Date],
cntnr,
orgn

Resident Parts
where cntnr <> Previous(cntnr)
Order by cntnr, [Date] desc;

drop Table Parts;
store Parts_MaxDate into $(vQVDPath)Parts_MaxDate.qvd;

Please help
Thanks

5 Replies
sbaro_bd
Creator
Creator

Hi @Bharathi09,

Explore the SQL WITH statement. Let us know if it is helpful.

Regards.

MarcoWedel

which one, there are two? what is the issue?

Bharathi09
Creator II
Creator II
Author

@MarcoWedel Hi, Thanks for replying 

Parts_maxdate table. Mainly I am looking for where condition 

Bharathi09
Creator II
Creator II
Author

Hi , 
Can you please help me on where condtion below , how to write it in SnowFlake

where cntnr <> Previous(cntnr)
Order by cntnr, [Date] desc;

Thanks

MarcoWedel

I think the Previous()-function would translate into LAG() OVER ... in Snowflake SQL