Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hi
I have two columns (startDateTime) and (EndDateTime) and I wanted to get the difference between two dates. My data format is as follows:
StartDateTime = 7/01/2011 3:31:00 PM
EndDateTime = 12/01/2011 8:44:00 AM
I created a column called differnce = DATEDIFF(File1[StartDateTime],File1[EndDateTime],HOUR)
I am getting a result = 3665
I changed the formula of difference to DATEDIFF(File1[StartDateTime],File1[EndDateTime],DAY)
than I am getting the result = 153
The answer should be 113hours (i.e. rounded down). I checked this in excel and it is giving me the right result.
Can someone please assist me with.
I am not sure what is going on. I even tried a simple subtraction but the result is still 153hours.
Thanks
Shei
@shei7141 the reason for this is that it converted your raw dates into:
July 1st, 2011 and Dec 01st, 2011 whereas you are doing the calculation assuming following
Jan 07th, 2011, and Jan 12th, 2011 and that's how the number of hours turned out to be 113.
You need to make your culture in change data type is set to dd/mm/yyyy rather mm/dd/yyyy
and that's the underline issue.
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi,
Between January 1, 2011 and December 1, 2022 there are 153 days. What is the problem?
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
User | Count |
---|---|
88 | |
85 | |
68 | |
68 | |
64 |
User | Count |
---|---|
210 | |
118 | |
116 | |
81 | |
74 |