Very small Power BI - Power M formula - time conversion
Budget: £10 – £20 GBP
I am new to Power BI and struggling to create a function which I need to make a start with some useful reporting. Hopefully this is easy if you know Power BI and the Power M / M Query language. I can't get my head round it at the moment.
I am looking for a function that I can then use repeatedly within Power BI in multiple reports.
I get a lot of reports in CSV format that report duration in the 'helpful' format Xwks Xd Xh Xm.
I need to convert them back into integer minutes. When there is no relevant weeks, days or hours, the section is omitted. Also there is no leading 0 for minutes or hours.
examples and required outcomes:
6m = 6
12m = 12
2h 15m = 135
1h 5m = 65
1d 7h 15m = 1875
2wks 4d 3h 1m = 26101
I've done this in Excel and this formula worked (where B1 is a cell value):
=VALUE(IFERROR(IFERROR(MID(B1, SEARCH("m", B1)-2,2),MID(B1, SEARCH("m", B1)-1,1)),0))+(VALUE(IFERROR(IFERROR(MID(B1, SEARCH("h", B1)-2,2),MID(B1, SEARCH("h", B1)-1,1)),0))*60)+(VALUE(IFERROR(IFERROR(MID(B1, SEARCH("d", B1)-2,2),MID(B1, SEARCH("d", B1)-1,1)),0))*1440)+(VALUE(IFERROR(IFERROR(MID(B1, SEARCH("wks", B1)-2,2),MID(B1, SEARCH("wks", B1)-1,1)),0))*10080);
Please use the codeword HOTEL in your response to show you have read this project.
I am looking for a function that I can then use repeatedly within Power BI in multiple reports.
I get a lot of reports in CSV format that report duration in the 'helpful' format Xwks Xd Xh Xm.
I need to convert them back into integer minutes. When there is no relevant weeks, days or hours, the section is omitted. Also there is no leading 0 for minutes or hours.
examples and required outcomes:
6m = 6
12m = 12
2h 15m = 135
1h 5m = 65
1d 7h 15m = 1875
2wks 4d 3h 1m = 26101
I've done this in Excel and this formula worked (where B1 is a cell value):
=VALUE(IFERROR(IFERROR(MID(B1, SEARCH("m", B1)-2,2),MID(B1, SEARCH("m", B1)-1,1)),0))+(VALUE(IFERROR(IFERROR(MID(B1, SEARCH("h", B1)-2,2),MID(B1, SEARCH("h", B1)-1,1)),0))*60)+(VALUE(IFERROR(IFERROR(MID(B1, SEARCH("d", B1)-2,2),MID(B1, SEARCH("d", B1)-1,1)),0))*1440)+(VALUE(IFERROR(IFERROR(MID(B1, SEARCH("wks", B1)-2,2),MID(B1, SEARCH("wks", B1)-1,1)),0))*10080);
Please use the codeword HOTEL in your response to show you have read this project.