Skip to main content

Hi All,

 

I have a dataset which has Day, Month, and Year column with some missing values. 

I would like to create a date field out of it.

I also would like to replace the missing Days with 1 , missing Months with ‘Jan’ so that I have the output as in my attached file Date Create(Output).

 

While I am able to create a Date from the date , month and year column by using the calculated field

DATE(DATEPARSE ( "MMM/dd/yyyy", [Month] + "/" + STR([Day]) + "/" + str([Year]) )  )

 

I am getting NULLS for which either then Month or day is missing. 

 

Please advise as to how should I impute the missing day with 1 and missing month with Jan before creating the date. 

 

Regards,

Rishi Saka

6 Antworten
  1. 5. März 2020, 19:25

    Hello Rishi,

     

    This calculation should do it.

     

    date(str([Year])+"-"+IFNULL(str([Month]),"1") + "/" + IFNULL(str([Day]),"1"))

     

    Hope this helps! See Attached.

    Please mark this answer as correct or helpful if it helps solve your question.

     

    Robert Breen

0/9000