Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Several columns within my data have datetime fromatted as a text string yyyyMMddHHmm and I am trying to create a custom function to invoke while creating a new column that converts this string to MM-dd-yyyy HHmm; however, I have been unsuccessful. Any help would be appreciated. I am new to Power BI and Power Query Editor. I have tried the below without success.
let
ConvertTextToDate = (textDate as nullable text) =>
if textDate <> null then
DateTime.FromText(textDate, [Format="yyyyMMddHHmm"])
else
null
in
ConvertTextToDate
Solved! Go to Solution.
Hi @E9067
You can refer to the following solution.
1.Create a blank query, and put your function code to the advanced editor.
2.In your original table, click the "Invoke Custom function" in Add Column
3.Select the function you have created in step1, in this sample the function name is 'Query1', and select the column in table you want to use the function.
4.Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @E9067
You can refer to the following solution.
1.Create a blank query, and put your function code to the advanced editor.
2.In your original table, click the "Invoke Custom function" in Add Column
3.Select the function you have created in step1, in this sample the function name is 'Query1', and select the column in table you want to use the function.
4.Output
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 16 | |
| 12 | |
| 9 | |
| 7 | |
| 6 |