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!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi all,
Working in Live Connect (so I cannot seperate columns), I have a datetime column in the following 24H format: "YYYY-MM-DD HH:MM:SS.ttt", e.g. "2019-05-13 15:18:40.963".
I'm trying to make a measure summing the sales in the previous full hour, assuming I have a measure returning the max value in that column (max(Updatetime)).
So in the about example, the sum of sales will be for the time between "2019-05-13 14:00:00.000" (bottom) and "2019-05-13 14:59:59.999 (top)".
My problem is finding the top and bottom boundries using dax and keeping them in the same datetime format.
Any assistance would be welcome.
Thank you!
Solved! Go to Solution.
Hi @Anonymous
Please see the below DAX expression, you should be able to adjust it to what you need and then add extra calculation to obtain sum .
Your Measure =
VAR dateTime = NOW() -- Your max(Updatetime)
VAR TimeEnd = DATEVALUE(dateTime) + TIME(INT(TIMEVALUE(dateTime) * 24), 0, 0)
VAR TimeStart = TimeEnd - TIME(1, 0, 0)
RETURN TimeStart & " - " TimeEndRegards,
Mariusz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous
Please see the below DAX expression, you should be able to adjust it to what you need and then add extra calculation to obtain sum .
Your Measure =
VAR dateTime = NOW() -- Your max(Updatetime)
VAR TimeEnd = DATEVALUE(dateTime) + TIME(INT(TIMEVALUE(dateTime) * 24), 0, 0)
VAR TimeStart = TimeEnd - TIME(1, 0, 0)
RETURN TimeStart & " - " TimeEndRegards,
Mariusz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This works perfectly, thank you!
much more elegant than I initially thought.
I tried using "left", "datepart", "format", "datevalue" and other workarounds and failed.
So thanks a lot!
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!