Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I have the following data in an SQL table. There are numerous Station ID's and each station ID has numerous scans per day. I would like to be able to get the first and last scan of each day and calculate the hours between those 2 times to obtain the length of time the machine was running. I am using Direct Query and was getting an error message using the min function when trying to calculate square feet per hour.
Solved! Go to Solution.
HI @Dane
You can split the DateTime column to two columns for Time and Date, then use these codes to find the first and last time for each date:
First = calculate(MIN(table[Time]),allexcept(table,table[Date]))
Last = calculate(MAX(table[Time]),allexcept(table,table[Date]))
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: www.linkedin.com/in/vahid-dm/
HI @Dane
You can split the DateTime column to two columns for Time and Date, then use these codes to find the first and last time for each date:
First = calculate(MIN(table[Time]),allexcept(table,table[Date]))
Last = calculate(MAX(table[Time]),allexcept(table,table[Date]))
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: www.linkedin.com/in/vahid-dm/
Hi, @Dane
Please check this example:
Did I answer your question? Please Like and Mark my post as a solution if it solves your issue. Thanks.
Appreciate your Kudos !!!
https://www.youtube.com/channel/UCndD_QZVNB_JWYLEmP6KrpA
https://www.linkedin.com/company/77757292/
Proud to be a Super User!
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.