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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.