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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
v-stephen-msft
Community Support
Community Support

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
v-stephen-msft
Community Support
Community Support

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
Impactful Individual
Impactful Individual

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors