Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
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.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.