cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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 🙂 

 

Victor

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
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! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





View solution in original post

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! Appreciate your Kudos 🙂
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! Appreciate your Kudos 🙂
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

Highlighted
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! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





View solution in original post

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Users Online
Currently online: 325 members 2,843 guests
Please welcome our newest community members: