Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Can someone help me to script the query below?
I have 3 fields to use for this script.
1. Document Number
2. Approved Date
3. Release Date
Query: I wanted to get the month created (this could be approved date or release date). The problem is some of the rows of approved date are blanks. I wanted to get the released date insted for those blanks in approved date. How to do this script? Im not sure if if else statement would be fit for this.
Thank you..
Try like this
LOAD
DocumentNumber,
Month(If(Len(ApprovedDate) > 0, ApprovedDate, ReleaseDate)) AS Month
// if it is really date field, try Month(Alt(ApprovedDate, ReleaseDate)) AS Month
FROM DataSource
LOAD
[Document Number],
if(not isnull([Approved Date]), Month([Approved Date]), Month([Release Date])) as [Release Month]
FROM ...
Try like this
LOAD
DocumentNumber,
Month(If(Len(ApprovedDate) > 0, ApprovedDate, ReleaseDate)) AS Month
// if it is really date field, try Month(Alt(ApprovedDate, ReleaseDate)) AS Month
FROM DataSource
The Alt() function is the best solution to your problem as it replaces any null values with the field in your first argument with your specified second argument.
Try like below:
LOAD [Document Number] ,
Month( ALT(Release_date,Approved_date)) AS Released_Month
FROM ,,,,;
Hi,
It worked! Helped a lot
Thank you!!
Hi Whiteline,
Thanks for this script. It helped too
Yes, is used Alt and worked. Thanks!
Thank you!