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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
KJH
New Member

How to sum time in hours and minutes

Hi,

 

Trying to sum total time of in hours and minutes and seconds. I have converted the time to decimal format and tried the DAX code below though it is not giving me the correct number of days before I then divide to only show hours,mins & secs.

 

KJH_0-1706018156623.pngKJH_1-1706018201246.png

Can anyone assist me with where i am going wrong?

Thanks

KJH

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @KJH

I think it's possible to create a Table based on the Total Hours in your image.

vyilongmsft_0-1706516248797.png

Then create a Calculate Column to represent the value of Show in hours and minutes.

Total Sum of Hours =
     FORMAT(INT(20102.25),"00") & "h," & FORMAT(MOD(20102.25,1)* 60, "00") & "m"

vyilongmsft_1-1706516248800.png

Finally, convert it to Card form.

vyilongmsft_2-1706516341046.png

 

How to Get Your Question Answered Quickly 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi, @KJH

I think it's possible to create a Table based on the Total Hours in your image.

vyilongmsft_0-1706516248797.png

Then create a Calculate Column to represent the value of Show in hours and minutes.

Total Sum of Hours =
     FORMAT(INT(20102.25),"00") & "h," & FORMAT(MOD(20102.25,1)* 60, "00") & "m"

vyilongmsft_1-1706516248800.png

Finally, convert it to Card form.

vyilongmsft_2-1706516341046.png

 

How to Get Your Question Answered Quickly 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

KJH
New Member

Hi, sorry, i could not get the above to work. I am looking to have the card showing the total time in hours and minutes.

 

This is not allowing me to upload a sample xlxs or power BI file.

 

KJH

ryan_mayu
Super User
Super User

@KJH 

maybe you can try something like below

Column = 
VAR d=int('Table'[hour]/24)
VAR h=int('Table'[hour]-d*24)
VAR m=int(('Table'[hour]-int('Table'[hour]))*60)
VAR s=('Table'[hour]-int('Table'[hour]))*60-int(('Table'[hour]-int('Table'[hour]))*60)
return d&"d"&","&h&"h"&","&m&","&s&"s"

11.PNG

if it's still not working, pls provide the sample data and expected output.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

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.