Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
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.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
9 | |
8 | |
8 | |
8 |
User | Count |
---|---|
13 | |
12 | |
11 | |
10 | |
9 |