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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote 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
Solution Sage
Solution Sage

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
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.