Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowHi Folk ,
Got stuck in one place wherein i want to convert decimal time values into correct time format like HH:MM:SS
Please find below snip :-
Dax I have tried is :-
ODI SSC Actual_New 1 =
VAR _TPHnPT =
DIVIDE(
SUM('PBIUSER MAX_WORKORDER'[Property Events Seconds]),
[SSC_Total_Props],
0
)
VAR Duration = _TPHnPT
VAR hours = ROUNDDOWN ( _TPHnPT / 3600, 0 )
VAR minutes = ROUNDDOWN ( MOD ( _TPHnPT, 3600 ) / 60, 0 )
VAR seconds = INT ( MOD ( _TPHnPT, 60 ) )
Return
RIGHT("0" & Hours,2) & ":" & RIGHT("0" & Minutes , 2 ) & ":" & RIGHT("0" & Seconds , 2)
Also , by writing this code , i am facing a new problem with calendar slicers as well , as years are not getting showing correct in table with slicer selection.
Code is not working for me here .
How to solve this ?
Thanks in advance for the help .
No need to break it down into hours, minutes, seconds. Please try the approach in this article.
Calculate and Format Durations in DAX – Hoosier BI
Pat
@ppm1 See if these help:
Decimal Duration Converter - Microsoft Power BI Community
Chelsie Eiden's Duration - Microsoft Power BI Community
Both of the articles are not working in my case
Hello @Sajid02
The value ODI SSC actual is in hours?
Example, the value 2.00 is 02:00:00 ?
Can you share a pbix with some dummy values?
Best regards
Bruno Costa | Solution Supplier
Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!! 👍
Take a look at the blog: PBI Portugal
Best regards
Bruno Costa | Super User
Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!!
Take a look at the blog: PBI Portugal
Hi @onurbmiguel_
The Value is in the form of seconds like
0.35 is 35 seconds
1.25 is 1 minute and 25 seconds and so on
hello @Sajid02
One other question , so if you have 1,50 it qill be 00:01:50 ? and if you have 1,90 ?
Best regards
Bruno Costa | Impactful Individual
Best regards
Bruno Costa | Super User
Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!!
Take a look at the blog: PBI Portugal
Hi
If i have 1.90 then it should be 00:02:30 sec
Hi @Sajid02
The examples that you shared does not make sense.
Can you indicated the output for the following examples:
0.05 -> 00:00:05
0.35 -> 00:00:35
1.25 -> 00:01:25
1.50 -> 00:01:50
1.90 -> 00:02:30
2.30 -> 00:02:30
2.80 -> 00:03:20
3.20 -> 00:03:20
65.50 -> 01:05:30
65.30 -> 01:05:30
Best regards
Bruno Costa | Impactful Individual
Best regards
Bruno Costa | Super User
Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!!
Take a look at the blog: PBI Portugal
Hi ,
You logic make sense on this part . but just now confused on some part .
Like all these values are cming after a dax i.e
Here is an example of how to format your variable (in seconds) in your desired format. I commented out the SUM expression to show what yours might look like, and put a hard-coded value from your example above to get a result of 2.30.
Hi
Tried this code but this is returning the incorrect value , plus it's also creating conflict with Calendar Slicer as Fiscal years getting changed.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
User | Count |
---|---|
98 | |
69 | |
66 | |
49 | |
41 |