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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
SCM
Contributor
Contributor

how simply my script

 

1st function  (find the last date for last month)

date((date(date(floor(monthend(addmonths(Today(),-1))),

2nd function ( to calculate diff between month of previous month and booking date for calculate the Aging)

date((date(date(floor(monthend(addmonths(Today(),-1))),
'DD/MM/YYYY'),'DD/MM/YYY')-date("Pstng Date",'DD/MM/YYYY')),'M') as 'AGING',

my question is there anyway to simplify my 2nd  function, can i do it without copy paste whole 1st function 

Labels (1)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

Function 1 simplified:
Dayname(monthend(Today(),-1))

You can not reuse the output of a field inside the same LOAD, you will need to re-write the expressing. You can however use presiding load.
LOAD
*,
monthenddate - DateField
;
Load
DateField,
Dayname(monthend(Today(),-1)) as monthenddate
FROM ...
;

View solution in original post

1 Reply
Vegar
MVP
MVP

Function 1 simplified:
Dayname(monthend(Today(),-1))

You can not reuse the output of a field inside the same LOAD, you will need to re-write the expressing. You can however use presiding load.
LOAD
*,
monthenddate - DateField
;
Load
DateField,
Dayname(monthend(Today(),-1)) as monthenddate
FROM ...
;