March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
i have date time am pm column and i need to convert it in query editor in date time 24 h format: "DD:MM:YYY HH:MM"
How can i write format?
= Table.TransformColumnTypes(dbo_PrxGetWaterLevelData,{{"DATETIME", type datetimezone}})
or in "advanced editor"
Solved! Go to Solution.
Hi giorgilomidze,
To achieve your requirement, please follow steps below:
1.Make sure that the data type of time column has been changed to Data/Time. In Query Editor, click Transform->Data Type->Select Data/Time
2.Then add a new column in which datatime will be transformed to 24h format. Click Add Column->Custom Column, rename the new column and input M code as below:
Time_New = DateTime.ToText([Time],"dd-MM-yyyy HH:mm:ss")
Or you can also add M code as below in Advanced Editor:
#"Added Custom" = Table.AddColumn(#"Changed Type", "Time_New", each DateTime.ToText([Time],"dd-MM-yyyy HH:mm:ss"))
The result is as below and you can refer to PBIX file: https://www.dropbox.com/s/ytnw7d1cpg8fwp7/For%20giorgilomidze.pbix?dl=0
Best Regards,
Jimmy Tao
Hi giorgilomidze,
To achieve your requirement, please follow steps below:
1.Make sure that the data type of time column has been changed to Data/Time. In Query Editor, click Transform->Data Type->Select Data/Time
2.Then add a new column in which datatime will be transformed to 24h format. Click Add Column->Custom Column, rename the new column and input M code as below:
Time_New = DateTime.ToText([Time],"dd-MM-yyyy HH:mm:ss")
Or you can also add M code as below in Advanced Editor:
#"Added Custom" = Table.AddColumn(#"Changed Type", "Time_New", each DateTime.ToText([Time],"dd-MM-yyyy HH:mm:ss"))
The result is as below and you can refer to PBIX file: https://www.dropbox.com/s/ytnw7d1cpg8fwp7/For%20giorgilomidze.pbix?dl=0
Best Regards,
Jimmy Tao
can I change format to 24H without converting to text?
yes you can, have a look at the example below.
TimeMeasure = FORMAT(CALCULATE (
MIN('Date'[DateTime]),
FILTER (
'Date',
'Date'[DateTime] = whatever
)
),"HH:mm AM/PM")
its the format that does this, wrap your DAX funtion with a FORMAT and to get the time out of a date.
regards,
Rob.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |