Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi,
As per official documentation Text.PositionOf - PowerQuery M | Microsoft Docs,
Text.PositionOf(text as text, substring as text, optional occurrence as nullable number, optional comparer as nullable function) as any
This function returns the position of the specified occurrence of a substring found in text. Adding this as a new column via
Text.PositionOf([text], ".")
to find a position of a dot in the column "text", in turn, converts this function into the following expression in Native Query:
charindex([_].[text], '.') - 1 as [Custom]
However, as per official SQL documentation CHARINDEX (Transact-SQL) - SQL Server | Microsoft Docs,
CHARINDEX ( expressionToFind , expressionToSearch [ , start_location ] )
the substring should come first, so the correct expression in Native Query would be:
charindex('.', [_].[text]) - 1 as [Custom]
As a result, the current implementation always returns -1 suggesting that the substring cannot be found. I've also found that switching substring and text in the Power Query function returns the desired result, but in such a case the position of substring and text is not correct as per official documentation.
Could you please check and correct if necessary?
Regards,
Karim
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Anonymous
May I know how you create your column? I’ve tested according to the description, but it works well and there will be no Native Query for custom column.
Best Regards,
Community Support Team _ Caiyun