Forum Discussion
Formatting Time and Null Time
- 4 years ago
Hi cdizzle22
You can replace null with the current datetime with the following code. Replace "previous step name" with your last step name in Power Query Editor.
= Table.ReplaceValue(#"previous step name",null,DateTime.LocalNow(),Replacer.ReplaceValue,{"Resolved Time"})Then create a custom column with [Resolved Time] - [Open Time] to get the duration.
Add another custom column to format the Duration values. The new Duration column will be Text type.
= Table.AddColumn(#"Added Custom", "Duration new", each Text.From(Duration.Days([Duration])) & "Days," & Text.From(Duration.Hours([Duration])) & "Hours," & Text.From(Duration.Minutes([Duration])) & "Minutes")If you want to convert format with DAX method at report side, you can refer to the following blogs:
Converting Decimal Time to Days, Hours, Minutes, Seconds in Power BI • My Online Training Hub
Calculate Duration in Days Hours Minutes and Seconds Dynamically in Power BI using DAX - RADACAD
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hi cdizzle22
You can replace null with the current datetime with the following code. Replace "previous step name" with your last step name in Power Query Editor.
= Table.ReplaceValue(#"previous step name",null,DateTime.LocalNow(),Replacer.ReplaceValue,{"Resolved Time"})
Then create a custom column with [Resolved Time] - [Open Time] to get the duration.
Add another custom column to format the Duration values. The new Duration column will be Text type.
= Table.AddColumn(#"Added Custom", "Duration new", each Text.From(Duration.Days([Duration])) & "Days," & Text.From(Duration.Hours([Duration])) & "Hours," & Text.From(Duration.Minutes([Duration])) & "Minutes")
If you want to convert format with DAX method at report side, you can refer to the following blogs:
Converting Decimal Time to Days, Hours, Minutes, Seconds in Power BI • My Online Training Hub
Calculate Duration in Days Hours Minutes and Seconds Dynamically in Power BI using DAX - RADACAD
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.