Forum Discussion
Radhika_Kanaka
Helper I
4 years agoRounding to nearest minute in DAX
Hi, I am trying to round the time to the nearest minute. Can someone help me to achieve this in DAX? Below is the sample data. 0:11:59 -> 11 Minutes 59 Seconds (12) 0:19:29 -> 19 Minutes 29 S...
- Anonymous4 years ago
Hi Radhika_Kanaka ,
Please try:
Column = VAR _minutes = HOUR ( [Time] ) * 60 + MINUTE ( [Time] ) VAR _round = IF ( SECOND ( [Time] ) < 30, _minutes, _minutes + 1 ) RETURN IF ( [Time] = TIME ( 0, 0, 0 ), "Not Included", _minutes & " Minutes " & SECOND ( [Time] ) & " Seconds (" & _round & ")" )Output:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
4 years agoNot applicable
Hi Radhika_Kanaka ,
Please try:
Column =
VAR _minutes =
HOUR ( [Time] ) * 60
+ MINUTE ( [Time] )
VAR _round =
IF ( SECOND ( [Time] ) < 30, _minutes, _minutes + 1 )
RETURN
IF (
[Time] = TIME ( 0, 0, 0 ),
"Not Included",
_minutes & " Minutes "
& SECOND ( [Time] ) & " Seconds (" & _round & ")"
)
Output:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.