Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
WillianLopes
New Member

Issues with NULL in an added and custom column

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"



1 REPLY 1
Anonymous
Not applicable

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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors