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
jay_patel
Helper IV
Helper IV

Need to get Total in Time Format

Hello All,

 

Need help to get sum of Time(HH:MM) in Total, Here we converted minutes into HH:MM getting properly, in  matric visual at "Total" we are getting only earliest value only but need to get total for that day.

For reference inserting image.  Need to get Total in top.


Thanks in Advance

Time.PNG 

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @jay_patel ,

Wishout your pbix file ,and you can see the below sample:

basic data:

v-luwang-msft_0-1618813165938.png

 

And then use the follow measure:

Measure = FORMAT(SUM('Table'[one])+SUM('Table'[two])+SUM('Table'[three]),"hh:nn")

And final I get:

v-luwang-msft_1-1618813232721.png

I have done the calculations manually and they are accurate.

 

Wish it is helpful for you!

 

Best Regards

Lucien

View solution in original post

3 REPLIES 3
HarishKM
Impactful Individual
Impactful Individual

@jay_patel  Hey 

You can use below 


Total hours_new =
SUMX (
FILTER ( ALL ( 'test_hhnn' ), [Date] = SELECTEDVALUE ( test_hhnn[Date] ) ),
HOUR ( [D1] ) + HOUR ( [D2] )
+ ( MINUTE ( [D1] ) + MINUTE ( [D2] ) ) / 60
)

Kudos will be appriciated 

v-luwang-msft
Community Support
Community Support

Hi @jay_patel ,

Wishout your pbix file ,and you can see the below sample:

basic data:

v-luwang-msft_0-1618813165938.png

 

And then use the follow measure:

Measure = FORMAT(SUM('Table'[one])+SUM('Table'[two])+SUM('Table'[three]),"hh:nn")

And final I get:

v-luwang-msft_1-1618813232721.png

I have done the calculations manually and they are accurate.

 

Wish it is helpful for you!

 

Best Regards

Lucien

mahoneypat
Employee
Employee

One way to do that easily is to store your times/durations as decimal numbers instead so you can easily do math on the (SUM, etc.).  You can then wrap your result with FORMAT() to display it the way you want.  In the example below, a decimal column with Durations is SUMmed and then displayed as hours/minutes.  Note that the decimal number is in the units of days.

 

Duration = FORMAT(SUM(Durations[Durations]), "hh:mm")
 
Regards,
Pat




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


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.