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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
khaycock
Helper I
Helper I

Summarising days/hours/mins

I have used the below to create a days/hours/mins field but it doesn't summarise because it's a text field. Is there any other calucation i can use which will allow me to summarise when there are multiple lines of days/hours/mins? (it's a ticketing system so ideally i would want to summarise)

 

days.PNG

 

Thanks!

2 ACCEPTED SOLUTIONS
v-jayw-msft
Community Support
Community Support

Hi @khaycock ,

 

Will you consider to create a measure instead of a column?

Measure = 
var minu = SUM(tickets[ticket time])
var hours = INT(minu/60)
var days = INT(hours/24)
var remainmin = MOD(minu,60)
var remainhours = MOD(hours,24)
return
days&" days, "&remainhours&" hours & "&remainmin&" minutes"

8.PNG

 

Best Regards,

Jay

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

View solution in original post

Hi @khaycock ,

 

The only thing you need to do is to replace sum() to average().

And if you want a whole number, you could add int() before mod().

Refer:

 

Measure 2 = 
var minu = AVERAGE(tickets[ticket time])
var hours = INT(minu/60)
var days = INT(hours/24)
var remainmin = INT(MOD(minu,60))
var remainhours = MOD(hours,24)
return
days&" days, "&remainhours&" hours & "&remainmin&" minutes"

 

0.PNG

 

Best Regards,

Jay

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

View solution in original post

9 REPLIES 9
v-jayw-msft
Community Support
Community Support

Hi @khaycock ,

 

Will you consider to create a measure instead of a column?

Measure = 
var minu = SUM(tickets[ticket time])
var hours = INT(minu/60)
var days = INT(hours/24)
var remainmin = MOD(minu,60)
var remainhours = MOD(hours,24)
return
days&" days, "&remainhours&" hours & "&remainmin&" minutes"

8.PNG

 

Best Regards,

Jay

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

If I wanted to use this to show average, could I just change the first variable like the below? Also how do I get it to not have all the decimal places?avg.PNG

Hi @khaycock ,

 

The only thing you need to do is to replace sum() to average().

And if you want a whole number, you could add int() before mod().

Refer:

 

Measure 2 = 
var minu = AVERAGE(tickets[ticket time])
var hours = INT(minu/60)
var days = INT(hours/24)
var remainmin = INT(MOD(minu,60))
var remainhours = MOD(hours,24)
return
days&" days, "&remainhours&" hours & "&remainmin&" minutes"

 

0.PNG

 

Best Regards,

Jay

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

Amazing - thanks so much!! One final question, how can I amend it to make 1 day = 7.25 hours of a work day?

Hi @khaycock ,

 

You could modify '/24' to '/7.25'.

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
mahoneypat
Microsoft Employee
Microsoft Employee

This is best done by keeping your column as a decimal (in # days, for example) and using custom format strings to display it like that.

Use custom format strings in Power BI Desktop - Power BI | Microsoft Docs

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


Can you help me with what to put in the custom format options please? I have a decimal field already which shows the days so can use that

selimovd
Super User
Super User

Hey @khaycock ,

 

what do you mean it doesn't summarize?

The time should summarize depending on your filter context. Then at the end you return a text string with the summarized days, hours and minutes.

 

Or where are you struggling?

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Sorry that I wasn't clear! I basically want to show a card that summarises all our tickets and shows how many days/hours/minutes a type of ticket has taken within a month. I can get the days/months/years to show on a line-by-line basis but when i summarise to a ticket type level, it doesn't work due to it not being able to sum.

 

I also have a card which shows the average time a ticket took to close which is currently in a decimal number based on number of days, but would rather this showed as days/hours/mins too

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!

December 2024

A Year in Review - December 2024

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