Forum Discussion
Rounding up time
- Anonymous2 years ago
Hi rpinxt ,
As far as I know, measure in time format like Duration = MAX(SC1[D&T]) - MAX(Sheet1[ATA]) has a limitation of 24 hour. So if your duration is 24:01:00, Power BI will only return 00:01:00.
Here I suggest you to try DATEDIFF function.
Flag = VAR _HOURDIFF = DIVIDE(DATEDIFF(MAX(Sheet1[ATA]),MAX(SC1[D&T]),MINUTE),60) RETURN IF(_HOURDIFF>24,"Late","On Time")Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous2 years ago
Hi rpinxt ,
As far as I know, the time format data (like hh:mm:ss) in Power BI has the 24 hours limitation.
If you want to show hh:mm:ss data outer 24 hours, I suggest you to try code as below.
Please note that in this way your Duration will be in text data format.
Duration New = VAR _SECDIFF = DATEDIFF(MAX(Sheet1[ATA]),MAX(SC1[D&T]),SECOND) VAR _HOUR =INT(DIVIDE(_SECDIFF,3600)) VAR _MIN = INT(DIVIDE(MOD(_SECDIFF,3600),60)) VAR _SEC = _SECDIFF - _HOUR * 3600 - _MIN * 60 RETURN COMBINEVALUES(":",FORMAT(_HOUR,"00"),FORMAT(_MIN,"00"),FORMAT(_SEC,"00"))Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi rpinxt ,
As far as I know, the time format data (like hh:mm:ss) in Power BI has the 24 hours limitation.
If you want to show hh:mm:ss data outer 24 hours, I suggest you to try code as below.
Please note that in this way your Duration will be in text data format.
Duration New =
VAR _SECDIFF = DATEDIFF(MAX(Sheet1[ATA]),MAX(SC1[D&T]),SECOND)
VAR _HOUR =INT(DIVIDE(_SECDIFF,3600))
VAR _MIN = INT(DIVIDE(MOD(_SECDIFF,3600),60))
VAR _SEC = _SECDIFF - _HOUR * 3600 - _MIN * 60
RETURN
COMBINEVALUES(":",FORMAT(_HOUR,"00"),FORMAT(_MIN,"00"),FORMAT(_SEC,"00"))
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Looks very good Anonymous !
Text should not be a problem as we would not have to calculate with that "time" field again.
So it woud only be for displaying.
Thanks.