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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
patrickanderson
Partner - Contributor III
Partner - Contributor III

Is there something wrong with this? or another way to do it?

The goal is to take the dates and the SHPSLSLBS and roll them up into weeks,

Everything works but the week code still comes out D/M/YYYY which is not what i want. I want YYYYMMDD format to i can tie to other data.

Is there something wrong with my method here? you can change date formats in the load script right?

LDESource:

LOAD DTNUM,

weekend(ACTSHIPDATE,0,-1) AS Week,

SAP_CUSTNO

FROM

(qvd)

WHERE ORDDATE >= '1/1/2010';

Left Join

LOAD DTNUM,

PARTNO,

ORDSLSLBS,

ORDSHPLBS,

ADJSLSLBS,

ADJSHPLBS,

SHPSLSLBS,

SHPSHPLBS

FROM

(qvd)

where exists (DTNUM);

LDE:

Load

date(Week,'YYYYMMDD') as Week,

SAP_CUSTNO,

PARTNO,

sum(SHPSLSLBS) as LDE_Volume

RESIDENT LDESource

GROUP BY Week, SAP_CUSTNO,PARTNO ;

Drop Table LDESource;



1 Solution

Accepted Solutions
vgutkovsky
Master II
Master II

Well "date(Week,'YYYYMMDD') as Week" just tells QV that "Week" is already in the format "YYYYMMDD" and to use that format to read the date properly. Meaning, it's not used for writing the date. So you can either change the variables at the beginning of the script (SET DateFormat=YYYYMMDD';) or make that particular date function a date transform: date#(date(Week,'YYYYMMDD'),'YYYYMMDD') as Week.

Regards,

View solution in original post

2 Replies
vgutkovsky
Master II
Master II

Well "date(Week,'YYYYMMDD') as Week" just tells QV that "Week" is already in the format "YYYYMMDD" and to use that format to read the date properly. Meaning, it's not used for writing the date. So you can either change the variables at the beginning of the script (SET DateFormat=YYYYMMDD';) or make that particular date function a date transform: date#(date(Week,'YYYYMMDD'),'YYYYMMDD') as Week.

Regards,

martin59
Specialist II
Specialist II

Hi,

You have to use the formatting function "date()" like this :

LOAD ... , Date(Weekend(ACTSHIPDATE,0,-1),'YYYYMMDD') as Week... FROM ...


Is that you want ?