Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi there,
So I have two datetime columns and I have calculated the difference between them using:
each Duration.ToText([end date]-[start date]), type number)
I have a column with values such as
78.08:11:05 = 78 days, 8 hours, 11 minutes, 5 seconds
00.00:54 = 0 days, 0 hours, 0 minutes, 54 seconds
As a number, this is throwing up an error when I close and apply as I guess DAX doesn't like the format.
I am going to need to be able to translate this column into a turnaround measurement.
Can you suggest anything to stop this erroring when I get to Report View, and also be able to sum this and have it recognised as a period of time?
Solved! Go to Solution.
I believe you should be using Power Query's Duration data type instead of number.
Here is something that I wrote recently for dealing with Durations in DAX:
In DAX it is more of a formatting thing since it does not have a true duration data type.
In case both are DateTime. You should be able to use datediff. And if you can give diff in the required unit.
https://docs.microsoft.com/en-us/dax/datediff-function-dax
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.
My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601
In case both are DateTime. You should be able to use datediff. And if you can give diff in the required unit.
https://docs.microsoft.com/en-us/dax/datediff-function-dax
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.
My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601
I believe you should be using Power Query's Duration data type instead of number.
Here is something that I wrote recently for dealing with Durations in DAX:
In DAX it is more of a formatting thing since it does not have a true duration data type.
Thanks both, these both work, I prefer the dax though. Not sure why I forgot about this!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
83 | |
70 | |
60 |
User | Count |
---|---|
150 | |
115 | |
104 | |
89 | |
65 |