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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
olaszkar
Regular Visitor

List.RemoveMatchingItems function doesn't work

Hello ladies & Gents!

 

I have the following problem. I have a Power BI visualization where 2 excel tables are connected with 1:n connection. In order to make it work I need to eliminate all rows which are empty or cointains "null" information. There is a function in Power Query whcih can delete all empty rows. 

= Table.SelectRows(#"Első sorok megtartva", each not List.IsEmpty(List.RemoveMatchingItems(Record.FieldValues(_), {"", null})))

But it doesn't work.

My temporary solution works but it is definetely not the most professional way namely keeping the specific nunbers of rows from the table: = Table.FirstN(#"Típus módosítva",73) 

Here is the 1:n connection

olaszkar_0-1723119676799.png

When I want to remove empty rows with classic way, the Power Query does nothing and “null” values rows remain  - see the last row in this case - and corrupt my 1:n connection. So when I add one or more rows to the table I need to change the number of rows in Power Query equal also which is not the best way 

olaszkar_1-1723119922945.png

Can you offer me a solution which would work without any manual intervention? 

I'd appreciate that

 

Br: Karoly

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @olaszkar ,

 

We often remove nulls in Power Query by the following ways:

1.Apply a filter to the column so that it does not include nulls.

vstephenmsft_1-1723531865101.png

 

2.Regardless of the column, you remove rows that are blank. Start menu. Remove Rows option, Remove Blank Rows option.

vstephenmsft_2-1723531913090.png

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

Hi @olaszkar ,

 

We often remove nulls in Power Query by the following ways:

1.Apply a filter to the column so that it does not include nulls.

vstephenmsft_1-1723531865101.png

 

2.Regardless of the column, you remove rows that are blank. Start menu. Remove Rows option, Remove Blank Rows option.

vstephenmsft_2-1723531913090.png

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hello Stephen!

 

Yes, your solution worked. Can you please tell me the logic behind? (Why did it worked? Why does the filtering necessary?)

I'd appreciate it!

 

Br

Karoly 

PwerQueryKees
Super User
Super User

I don't fully understand what you are trying to achieve.

The use of the Table.Isempty combined with a Table.Selectrows comes to mind.

Or even simpler, a mergejoin with a left or richt anti.

But you may have tried that...

Hello!

 

All I want is to remove the "" or "null" rows from the bottom because it corrupts my 1:n connection. Unfortunately the standard solution (DAX is generated by Power Query): "Table.SelectRows(#"Típus módosítva", each not List.IsEmpty(List.RemoveMatchingItems(Record.FieldValues(_), {"", null})))" doesn't work.

I have a temporary solution, but it is not nice

Ahmedx
Super User
Super User

or

 

= Table.RemoveLastN(#"Első sorok megtartva", (x)=> List.IsEmpty( List.RemoveMatchingItems( Record.ToList(x),{"",null})))

 

olaszkar_0-1723187295392.png

Unfortunately this is the message I got back: the name Sorted rows1 can't be recognized.

I tried to modify the script: with integration of your proposal. Although there is no syntax error now, but as you cas see, the command is uneffective 😞

olaszkar_1-1723187807000.png

 

most likely your date column is not empty or there is another one that is not empty

Ahmedx
Super User
Super User

pls try this

 

 = Table.SelectRows( #"Első sorok megtartva",
     (x)=> not List.IsEmpty( List.Select( Record.ToList(x),(x)=> x<>"" and x <> null) ))

 

Hello Ahmedx!

 

Firstly thank you for your support. Unfortunately a syntax error popped up: 

"Első sorok megtartva"

can't be recognized by PBI. Honestly I don't know why. For me it is clear. When I tried to integrate your script after comma, there was no syntax error, but the command was as unneffective as the other solution

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors