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
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.





Highlighted
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

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
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 Badges

Incoming: New and Improved Badges

Exciting news: We've given our badges an overhaul and added brand news ones.

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.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 290 members 2,425 guests
Please welcome our newest community members: