Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have a table [example] like this:
submit_date | close_date | ID |
04/01/2022 | 08/01/2022 | A123 |
05/06/2023 | 14/07/2023 | A124 |
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!
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.
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.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
20 | |
7 | |
6 | |
5 | |
5 |
User | Count |
---|---|
24 | |
10 | |
10 | |
9 | |
6 |