cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
hmartins
New Member

Converting time data in format Xh Ym to hours (number)

Hello,

 

I am new to Power Bi, and even though I have seen a lot of videos and tutorials, I haven't figured or find out a solution for the following issue: I have made a connection between Jira and Power BI (without using any kind of plugins).

 

Now, I am trying to play with the SLA watches from Jira. I obtain how much time has been invested in a particular ticket in the following format:

 

215h 58m

 

I want to transform this to either hours or minutes, like:

 

215.97

 

OR

 

12958

 

Is there any function or code that someone has already built for this?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User II
Super User II

Re: Converting time data in format Xh Ym to hours (number)

Hi @hmartins 

In DAX you can create a calculated column

Column = 
var _formatted = SUBSTITUTE(SUBSTITUTE([TimeColumn],"m",""),"h ","|")
RETURN 
60*PATHITEM(_formatted,1)+PATHITEM(_formatted;2)

 

do not hesitate to give a kudo to useful posts and mark solutions as solution

LinkedIn


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

1 REPLY 1
Super User II
Super User II

Re: Converting time data in format Xh Ym to hours (number)

Hi @hmartins 

In DAX you can create a calculated column

Column = 
var _formatted = SUBSTITUTE(SUBSTITUTE([TimeColumn],"m",""),"h ","|")
RETURN 
60*PATHITEM(_formatted,1)+PATHITEM(_formatted;2)

 

do not hesitate to give a kudo to useful posts and mark solutions as solution

LinkedIn


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

Helpful resources

Announcements
Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

April 2020 Community Highlights

April 2020 Community Highlights

Info on our Super Users, MBAS content and badges, and updates to our support articles. - Read the full Community Highlights.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

Top Solution Authors
Top Kudoed Authors