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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
etabaku14
New Member

Calculate Sum of HH:MM column as text data type

Hi,
I want to calculate the sum of a column that contains data as text in the following format: 'HH:MM'

Time
04:15
02:15
11:05
17:35

 

I have all the listed times in a column, and want to add a Total value that adds all those time. Tried some formulas which were posted here at the community but couldn't find one where the data type of 'Time' column was text.

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @etabaku14 

 

You can try converting text to time format here.

vzhangti_0-1668756804903.png

Or try using the Timevalue function to change the time in text format to time format.

Column = TIMEVALUE([Time])

TIMEVALUE function (DAX) - DAX | Microsoft Learn

 

Measure = SUM('Table'[Time])

vzhangti_1-1668757049917.png

Measure 2 = CALCULATE(SUM('Table 2'[Time]),ALL('Table 2'))

vzhangti_2-1668757270233.png

If the result is different from what you expect, please provide more details.

 

Best Regards,

Community Support Team _Charlotte

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

5 REPLIES 5
v-zhangti
Community Support
Community Support

Hi, @etabaku14 

 

You can try converting text to time format here.

vzhangti_0-1668756804903.png

Or try using the Timevalue function to change the time in text format to time format.

Column = TIMEVALUE([Time])

TIMEVALUE function (DAX) - DAX | Microsoft Learn

 

Measure = SUM('Table'[Time])

vzhangti_1-1668757049917.png

Measure 2 = CALCULATE(SUM('Table 2'[Time]),ALL('Table 2'))

vzhangti_2-1668757270233.png

If the result is different from what you expect, please provide more details.

 

Best Regards,

Community Support Team _Charlotte

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

 

Thanks for your answer.
I have one question about: 

Measure 2 = CALCULATE(SUM('Table 2'[Time]),ALL('Table 2'))

Since I have filters in my report (Date range, radio buttons etc) this 'ALL' doesn't calculate the sum of the filtered data but all data with no filters.
Is there any option to calcualte based on the date range i picked, or let's say based on the filtered table

Hi, @etabaku14 

 

You can try.

Sample data:

vzhangti_0-1668763732837.png

Measure = CALCULATE(SUM('Table'[Time]),FILTER(ALL('Table'),[Date]=SELECTEDVALUE('Table'[Date])))

vzhangti_2-1668763821418.png

vzhangti_1-1668763811605.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

amitchandak
Super User
Super User

@etabaku14 , Try like

time(0,0,0) + Sumx(Table, left([time],2)*1 + right([time],2)/60) /24

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you for your time, but this didn't calculate the right value for the sum. I fixed this problem by creating a new column with a decimal number as the data type based on the column 'HH: MM'. Used formulas to express the time in a decimal number.

Now I have another problem: The calculated sum is not correct of the column. Basically I have a column with decimal numbers, but when I add the summarize option a wrong total is displayed.
Example:
I have a table same as above:

Time
1.2
2.5
2.3
 

 

And want to add a column to another table with the correct total value.

Total Value
6.0

But the Total Value column display wrong total
What I have tried:
SUMX(table, table[Time])
SUM, CALCULATE, COUNT ...

I am still not finding why the sum is different 😕

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.