Forum Discussion

beaverbuzz85's avatar
beaverbuzz85
Regular Visitor
3 years ago

Troubleshooting Simple Conversion of String to Date

Hello, 

 

I am trying to solve a seemingly simple issue. I am trying to convert the following to a year.

 

1999/2000 to 2000. 

 

1999/2000 (string)

 

My calculated column is this: 

Tax Year = RIGHT('Year'[Financial Year],4)
 
But after I try to convert that calculate column to "Date" it returns this error:
 
"Cannot convert value '2000' of type Text to type Date."
 
Thank you for the help!

4 Replies

  • Date format needs the complete set of YYYY-MM-DD, but you only have YYYY.  You can set it as text. 

    • beaverbuzz85's avatar
      beaverbuzz85
      Regular Visitor

      Thanks for the clarification. 

       

      I understand that you can't forecast with a basic line chart while the x-axis is text (i.e. the supposed year as you have described). 


      Could you please confirm?

  • Power BI allows the DATEVALUE DAX formula with parameter as Text, which includes date value in MM/DD/YYYY format, so you need to add the below expression:

     

    DateVal = DATEVALUE("01/01/" & RIGHT("1999/2000", 4))

    Please refer to the below screenshot for the same.

     

     

    Thanks!

    Inogic

    Innovative Logic  

    Web: www.inogic.com/services/

    Blog: http://www.inogic.com/blog

    twitter: @inogic