cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
VictorFR04 Frequent Visitor
Frequent Visitor

How to deal with Durations

Hi everyone.

 

I have some issues dealing with durations. For example, I have a column with the seniority of a worker in the format "X y. Ym" representing X number of years and Y number of months (ex: 2y. 4m). How can I transform this column to make it a duration ? PBI doesn't detect "y" as a year and "m" as a month. 

 

Also how to change the format of a duration into days, hours or minutes ? When you change a column with numbers into a duration, it automatically converts the number in minutes and I don't see how to change it to make it shaped as days, hours or minutes 

 

Thank in advance for your help Smiley Happy 

 

Victor

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: How to deal with Durations

@VictorFR04 solution is attached, lot of transformation is done to get the final result. Thought process is to get year and month inseperate columns and then it is easier to calculate any unit.





Did I answer your question? Mark my post as a solution.

Proud to be a Datanaut! Kudos Help Smiley Happy
Connect with me on Linkedin. Feel free to email me with any of your BI needs.




 




5 REPLIES 5
Super User
Super User

Re: How to deal with Durations

@VictorFR04 not fully clear if you data is in text or number y.m and what you want to convert this into?





Did I answer your question? Mark my post as a solution.

Proud to be a Datanaut! Kudos Help Smiley Happy
Connect with me on Linkedin. Feel free to email me with any of your BI needs.




 




VictorFR04 Frequent Visitor
Frequent Visitor

Re: How to deal with Durations

The data is in text format like below :

 

2y.

1y. 3m.

1y. 3m.

3m.

3y. 2m.

4y.

3m.

3y.

7y. 3m.

1y. 11m.

 

I want Power BI to convert those data as duration. But when I try it shows errors. 

Super User
Super User

Re: How to deal with Durations

@VictorFR04 when you say duration, what does that means? Hours/Minutes/Seconds/Week/Days???





Did I answer your question? Mark my post as a solution.

Proud to be a Datanaut! Kudos Help Smiley Happy
Connect with me on Linkedin. Feel free to email me with any of your BI needs.




 




VictorFR04 Frequent Visitor
Frequent Visitor

Re: How to deal with Durations

@parry2k In Months would be good for those kind of data, because it goes from 1 months to several years. So how do I convert text/number data type to months data type ? 

 

But I would also be interested in knowing how to convert numbers into days, hours and minutes. 

 

I was saying "duration" because t's one of the data type suggested by Power BI

 

Thank you

Super User
Super User

Re: How to deal with Durations

@VictorFR04 solution is attached, lot of transformation is done to get the final result. Thought process is to get year and month inseperate columns and then it is easier to calculate any unit.





Did I answer your question? Mark my post as a solution.

Proud to be a Datanaut! Kudos Help Smiley Happy
Connect with me on Linkedin. Feel free to email me with any of your BI needs.