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
evega
Frequent Visitor

How to add hours in power bi using DAX measurements

I have recently developed a measure in a context where filters are used to add up the total hours, but the result is not correct. 

 

Screenshot_11.png

1 ACCEPTED SOLUTION
TheoC
Super User
Super User

Hi @evega

Add this as a Calculated Column:

 

Total Time = 

VAR _TotalHours = INT ( LEFT ( Table[Horas] , 2 ) )
VAR _TotalMinutes = INT ( RIGHT ( Table[Horas] , 2 ) )

RETURN

_TotalHours + (_TotalMinutes / 60 )

Below is a screenshot of the output.  Hope this helps! 🙂

 

TheoC_0-1634078128083.png

 


 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

View solution in original post

6 REPLIES 6
evega
Frequent Visitor

Me ha funcionado, muchas gracias!!!  @TeoC

Screenshot_14.png

TheoC
Super User
Super User

Hi @evega

Add this as a Calculated Column:

 

Total Time = 

VAR _TotalHours = INT ( LEFT ( Table[Horas] , 2 ) )
VAR _TotalMinutes = INT ( RIGHT ( Table[Horas] , 2 ) )

RETURN

_TotalHours + (_TotalMinutes / 60 )

Below is a screenshot of the output.  Hope this helps! 🙂

 

TheoC_0-1634078128083.png

 


 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

evega
Frequent Visitor

Hi  @TeoC

It won't allow me.

 

Screenshot_12.png

@evega what Data Type is your Horas column?

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

evega
Frequent Visitor

The data type is time, but I'll try to switch to text

Hi @evega, that would be good if you could convert to text. Alternatively, I am happy to adjust to get you the output required.

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

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.