Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
heejinyune
Frequent Visitor

Problem with cannot convert text into date type

I have a table [example] like this:

submit_dateclose_dateID
04/01/202208/01/2022A123
05/06/202314/07/2023A124

 

and my dax code to return the table which have date differences:

TABLE = 

VAR table = 

        SUMMARIZE('example', [ID])

RETURN 

        GENERATE (

                table,

                VAR tableId = 'example'[ID]

                VAR SubDate = LOOKUPVALUE('example'[submit_date], 'example'[ID], [ID], 'example'[submit_date], "submitted_date")

                VAR SubDateCalc = DATEVALUE(SubDate)

                VAR CloseDate = LOOKUPVALUE('example'[tclose_date], 'example'[ID], [ID], 'example'[close_date], "closed_date")

                VAR CloseDateCalc = DATEVALUE(CloseDate)

 

However, while run this Dax command, having error with VAR SubDateCalc and VAR CloseDateCalc.

It keep giving me error that cannot convert text into date value..

 

Anyone know the solution? Thanks!

 

2 REPLIES 2
Anonymous
Not applicable

Hi @heejinyune ,

 

There are several reasons why you might be getting an error that says "cannot convert text into date value" in Power BI Desktop when using DAX. One possible reason is that the DATE object is getting transformed into a DATETIME in Power BI. Another possible reason is that the regional settings in Power BI Desktop are incorrect. To resolve this issue, you can try changing the regional settings in Power BI Desktop to your country/region. Please refer to

Change Type Using Locale with Power Query

Power Query Change Type Using Locale - YouTube

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.           

Martin_D
Super User
Super User

Hi @heejinyune ,
The easier place to reliably convert date as text to date as date-datatype is in Power Query using the "with locale" type conversion.
In DAX you can replace all occurrences of 

 

DATEVALUE ( 'Table'[Date Text] )

 

with

 

DATE ( 
    VALUE ( RIGHT ( 'Table'[Date Text], 4 ) ), 
    VALUE ( LEFT ( RIGHT ( 'Table'[Date Text], 7 ), 2 ) ), 
    VALUE ( LEFT ( 'Table'[Date Text], 2 ) ) 
)

 

The behavior of DATEVALUE depends on the Culture property of your dataset, so some users might have the same problem and some not. With my de-de culture there was no problem as you described. Anyway, with the code above you are an the save side, as long as your data format is always two digits day,two digits month,4 digits year.

 

github.pnglinkedin.png

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.