Forum Discussion
Anonymous
4 years agoNot applicable
Time Duration to Date Conversion
Hi ALL, New Bee here. I have a client request today to convert a Time Duration column to Date (As shown in the table). Can you experts please help me to achieve the exact date format with the code....
amitchandak
Super User
4 years agoAnonymous , You can split it on power Query using split by delimiters. Then you can remove the text.
Then you add it date
date(2022,01,01) + [week]+7 + [Day] + Time([Hour], [Minute], 0)
Anonymous
4 years agoNot applicable
Hi amitchandak :
As I am new to Power BI, I got struck here.
As per your suggestions, I did Split the delimiters and was able to achieve this . Can you please give me little more detailed steps on your second step (date(2022,01,01) + [week]+7 + [Day] + Time([Hour], [Minute], 0) ) where I was not able to frame a logic as per your suggestion.
Also, recently month is also added to the data with (Month Week Day Hour Minute)
Please help to crack this logic.
input:
| input |
| Derived Date |
| 1M 2w 5d 18h 54m |
| 1d 1h 3m |
| 2h 20m |
| 10m |
| output | ||||
| Month | Week | Day | hours | minutes |
| 1 | 2 | 5 | 18 | 54 |
| - | 1 | 1 | 3 | |
| - | - | 2 | 20 | |
| - | - | - | 10 |