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.
I have 2 tables. The main table is the sales ratio. It has the name of the products. However, these names are very long because the technical specification is also added next to the name. For example: an iron bar comes as a 2' H type iron bar. That list of sold items is huge.
The second list only has the name of some items that are sold. For example, iron bar.
So, I put together a code where I add a new column to the main table and do a search to find if that record has any of the words from table 2. If it is found, then it returns the item from table 2. So, keeping the example, it find iron bar and return it to me.
My problem is when in the main list there is no item that is registered in the second table: it returns null. Then, in the next step, Power Query throws an error saying that it was unable to convert null to text.
Can you please help me to resolve this situation?
let
Fonte = Lista_gerada_pelo_programa,
#"Colunas Removidas" = Table.RemoveColumns(Fonte,{"Tomador - CNPJ", "Tomador - Razão Social", "CTe - Nº"}),
#"Personalização Adicionada" = Table.AddColumn(#"Colunas Removidas", "NOVA", each Table.SelectRows(Lista_Variacoes, (x)=> Text.Contains ([Produto], x[Variacoes], Comparer.OrdinalIgnoreCase) )),
#"NOVA_Expandido" = Table.ExpandTableColumn(#"Personalização Adicionada", "NOVA", {"Produto", "Variacoes"}, {"NOVA.Produto", "NOVA.Variacoes"})
in
#"NOVA_Expandido"
Somewhere in there, you must be concatenating nulls, and null & anything else always returns null. Just go back and replace values of null with " " and it will work.
--Nate