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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
cham
Post Patron
Post Patron

Time format issue

Hi,

 

I have data set in Excel. It includes one column in total time. When I calculate the sum of the total time it gives me 

242:27:07

 

But when i get that sheet into Power BI and get the sum of the total time it will give me following,

time issue.PNG

I want to know how to change that. If I can show it in "DD:HH:MM: SS" it will be fine. Also if i can show it in "HHH:MM: SS" it will be also fine. How can I get that in Power BI?

 

Regards,

Cham

5 REPLIES 5
v-danhe-msft
Employee
Employee

Hi @cham ,

Based on my test, you could refer to below steps:

Sample data:

1.PNG

Create below measure:

Measure = var a=SUMX('Table1',HOUR('Table1'[Time])*3600+MINUTE('Table1'[Time])*60+SECOND('Table1'[Time])) 
return RIGHT ( "0" & INT ( a / 3600 ), 2 )
& ":"
& RIGHT (
"0"
& INT ( ( a - INT (a / 3600 ) * 3600 ) / 60 ),
2
)
& ":"
& RIGHT ( "0" & MOD (a , 3600 ), 2 )

Result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

 

This is not correct. Please check the below screenshot. When I got the SUM in Excel it shows me different total time. When I get the SUM in power BI it shows me different total time. 

 

And aslo the the measure you used shows different total time. Can you explain this?

 

time Power BI issue.PNG

Hi @cham ,

What is your formula in your excel, it could work on my side:

1.PNG

In Power BI, it will transform the time to date automatically, it is by design, so I used the measure to show the sum of the time.

 

 

Sorry for my carelessness, I have modified my formula:

Measure = var a = SUMX('Table1',HOUR('Table1'[Time])*3600+MINUTE('Table1'[Time])*60+SECOND('Table1'[Time]))
return
RIGHT ( "0" & INT ( a / 3600 ), 2 )
& ":"
& RIGHT (
"0"
& INT ( ( a - INT (a/ 3600 ) * 3600 ) / 60 ),
2
)
& ":"
& a-INT ( ( a - INT (a / 3600 ) * 3600 ) / 60 )*60-(RIGHT ( "0" & INT ( a / 3600 ), 2 ))*3600
 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

 

Normally when i click on user it will show me the correct total time of that particular user.

 

But when I SUM total time it will not show me the correct total. When I get the SUM of the total in Excel it will show me below total. I think Power BI is not showing like that because of the format. So, how can I get the correct total time in Power BI? 

 

After i use your formula it will give me below screen shot (Measure 2) 

time.PNGtime measure.PNG

Hi @cham ,

I could not figure which oucome you want to get:

The first one:

1.PNG

Or the second one:

2.PNG

I could give you all of the measure:

The first one:

Measure 2 = SUM(Table1[Time])

The second one:

Measure = var a = SUMX('Table1',HOUR('Table1'[Time])*3600+MINUTE('Table1'[Time])*60+SECOND('Table1'[Time]))  
 return 
RIGHT ( "0" & INT ( a / 3600 ), 2 )
& ":"
& RIGHT (
"0"
& INT ( ( a - INT (a/ 3600 ) * 3600 ) / 60 ),
2
)
& ":"
& a-INT ( ( a - INT (a / 3600 ) * 3600 ) / 60 )*60-(RIGHT ( "0" & INT ( a / 3600 ), 2 ))*3600

Result:

1.PNG

You could also download my pbix and excel file to have a try.

 

Regars,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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