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.
Goodday,
I have a CSV file withe a data-time field witch has the format (Jan 12, 2024 @ 19:39:03.793).
Is there a way to convert this format to a DD-MM-YYYY, HH:MM:SS with a dax code?
After a import of a new dataset, the dataconvert works.
Thanks you for your help.
Well, you have two different formats of date in your data then. here's the updated DAX to handle both formats.
DateTime_Converted =
VAR textDateTime = datetimesample[datetime]
VAR containsTime = CONTAINSSTRING(textDateTime, "@")
VAR cleanedDateTime = SUBSTITUTE(SUBSTITUTE(textDateTime, "@ ", ""), ",", "")
VAR datePart = IF(containsTime, LEFT(cleanedDateTime, LEN(cleanedDateTime) - 12), cleanedDateTime)
VAR timePartWithMilliseconds = IF(containsTime, RIGHT(cleanedDateTime, 12), "00:00:00")
VAR timePart = IF(containsTime, LEFT(timePartWithMilliseconds, 8), timePartWithMilliseconds) // Extracting only the HH:MM:SS part or default to 00:00:00 if no time part
RETURN
DATEVALUE(datePart) + TIMEVALUE(timePart)
Proud to be a Super User!
thank you, de Time convert part works fine, but the Date part has a issue. It says"Connot convert value 'Oct 31 2023' of type text to type Date.
Try this. Adjust the table and column name accordingly. This formula assumes that your original column is in text format.
Proud to be a Super User!
Unfortunately this code doesn't work either, maybe I can send you a PBix?
Sure, that will help
Proud to be a Super User!
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 |
---|---|
10 | |
9 | |
9 | |
8 | |
8 |
User | Count |
---|---|
14 | |
12 | |
11 | |
11 | |
8 |