Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Conversion of dates

Dear all,

 

I have a  table containing the order date in three separate fields: date, month and year.

 

I have tried to use :

ORDREDATO = COMBINEVALUES(".",ORDR[ORD_DD],ORDR[ORD_MM],ORDR[ORD_AAAA])
 
Unfortunately, this is failing because PowerBI does not recognize one character dates and months as a valid date format and the conversion to date fails:
 

In english the error message is: Can not convert the value 10.1.2019 for type Text to type Date.

I guess I have to add a leading zero before the "1" in the example. Any ideas?

Best regards

Kenneth Pedersen

  • Could you use the DATE function? Something like 

    ORDREDATO = DATE( ORDR[ORD_AAAA], ORDR[ORD_MM], ORDR[ORD_DD] )
  • Anonymous 

    ORDERDATO = DATE(YEAR(ORDR[ORD_AAAA]),MONTH(ORDR[ORD_MM]),DAY(ORDR[ORD_DD]))



3 Replies

  • AntonioM's avatar
    AntonioM
    Icon for Solution Sage rankSolution Sage

    Could you use the DATE function? Something like 

    ORDREDATO = DATE( ORDR[ORD_AAAA], ORDR[ORD_MM], ORDR[ORD_DD] )
  • SpartaBI's avatar
    SpartaBI
    Icon for Community Champion rankCommunity Champion

    Anonymous 

    ORDERDATO = DATE(YEAR(ORDR[ORD_AAAA]),MONTH(ORDR[ORD_MM]),DAY(ORDR[ORD_DD]))



  • Anonymous's avatar
    Anonymous
    Not applicable

    Thank you very much, SpartaBI  and AntonioM ! It was easier than I thought. 🙂

    Best regards
    Kenneth Pedersen