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
VictorFR04
New Member

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

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



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

5 REPLIES 5
parry2k
Super User
Super User

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



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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. 

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



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@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

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



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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.