The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
The Power Query function Text.PositionOf returns a list when the 'occurrence' parameter is set, so that the common scenario below gives error 'We cannot apply operator + to types List and Number'
Text.PositionOf("String with multiple spaces", " ", 2) + 1
Documentation states that 'An optional parameter occurrence may be used to specify which occurrence position to return (first occurrence by default).' - and that's all it states. It appears this happens because despite declaring the type of the parameter as nullable number, it is expecting an Occurrence.Type enum, so numbers higher than 1 do not correspond to the position within the list that's expected.
The documentation is misleading, so either that needs to be changed, or the parameter behaviour updated to a more reasonable interpretation, or at least restricting to the enum.
FYI I think the best workaround to this is just use Occurrence.All and retrieve the item you want by index
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.