Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi there,
I need you help in converting the folowing Excel function in Power query:
=DATE(MID(B2;7;2);FIND(MID(B2;9;1);"ABCDEHLMPRST");MOD(MID(B2;10;2);40))
This function extracts the date of birth from an alphanumerical code, but i am not sure on how i can implement it on Power Query.
Thanks!
Solved! Go to Solution.
Put below formula in a custom column. After pressing OK, select this custom column, Transform menu - Detect data type to convert 2 digits year to 4 digits year
= Text.Replace(Date.ToText(#date(Number.From(Text.Middle([Data],6,2)),Text.PositionOf("ABCDEHLMPRST",Text.At([Data],8))+1,Number.Mod(Number.From(Text.Middle([Data],9,2)),40))),"00","")
Put below formula in a custom column. After pressing OK, select this custom column, Transform menu - Detect data type to convert 2 digits year to 4 digits year
= Text.Replace(Date.ToText(#date(Number.From(Text.Middle([Data],6,2)),Text.PositionOf("ABCDEHLMPRST",Text.At([Data],8))+1,Number.Mod(Number.From(Text.Middle([Data],9,2)),40))),"00","")
It works like a charm, THANKS A LOT!
Sure:
An example of the string: ABCDEF74L71781E, where
| 74 | Year of birth, hence 1974 |
| L | Month of birth, hence July |
| 71 | Day of birth, 31 (71-40) |
The output is 31/07/1974 so the output is in dd/mm/yyyy format
Please post the sample strings on which this function operates. Please post as text not as picture. You can press table button in the editor to post table as well.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.