Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Ludvig
Frequent Visitor

Calculate a whole number times time and display it on the format hh:mm:ss (DAX measure)

Hi!

I have ancontered a problem with a DAX measure. I want to calculate an integer times the time as you can see in the DAX below:

the_measure.PNG

When i calculate x5 and display it in a table in PB everything is fine and it calculates as it should but when i calculate x6 the result is wrong, i get a result but it's wrong. I think this is due to the fact that x3 is alot bigger integer than x4 is, so when im stepping over one day i.e., 24 hours it starts over. Below you can se the result from x6: (i only have data for jan-maj 2023)

the_result.PNG

 

So if we calculate what is should be: x2 = 00:01:27 and x4 = 1816, 

00:01:27 in seconds = 87 seconds. 

87 seconds * 1816 = 157 992 seconds, now we transform it back:

hours = 157 992/3600 =~ 43.887 => 43 hours

minutes = 157 992/3600 -43 =~ 0.887 hours => 0.887*60 = 53.2 minutes

seconds = 53.2-53 = 0.2 minutes => 0.2*60 = 12 seconds

So the answer should be 43:53:12 for januari but as you can see it's 19:53:12.

If we put one and one togheter we can see that 19:53:12 + 24:00:00 = 43:53:12, so as i said after 24 hours it starts over. It does not happend for x5 since x3 is so small. Here is the data in the table:

the_table.PNG

How can i fix this so it dosent start over but instead just add on more hours, minutes and seconds?

Thanks in advanced!

 

1 ACCEPTED SOLUTION
2 REPLIES 2
Ludvig
Frequent Visitor

Thanks it works fine!

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.