Often in PowerBI we have to deal with strings in such cases the FIND function comes handy in fetching the position of a particular word within a string. This can be used to identify and fix errors such as with the format. It can also be used in combination with REPLACE etc. to change name from Last Name, First Name to First name Last Name etc. For SQL developers the FIND function is similar to Patindex. This Functions added as a column to the PowerPivot table as shown below:-

ExFindBlueStock = FIND("Blue",'Dimension Stock Item'[Stock Item],1,-1)

Often we don’t use FIND on its own but in combination with some other functions as we will see in the next example where we use the IF Function to perform some operation on the data if the exFindBlueStocK is greater than or equal to 0

The SQL equivalent of would be similar to

SELECT patindex('%Blue%', [Stock Item])
    ,[Stock Item]
FROM [Dimension].[Stock Item]

Please Consider Subscribing

Leave a Reply