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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
GeekAlfPro
Helper V
Helper V

FILTER NOT TEXT.STARTSWITH

Hello,

 

i have a strange way of working in filter step.

i have rows within there is the remorque word.

i want to keep the rows that not start with "remorque"

 

Table.SelectRows(#"Récupération Grp", each not Text.StartsWith([Genre Machine], "REMORQUE"))

 

so far so good, but the filter removes also null rows 

GeekAlfPro_0-1726496747576.png

GeekAlfPro_1-1726496781616.png

 

 

is it normal ?

 

thanks 

 

1 ACCEPTED SOLUTION
dharmendars007
Super User
Super User

Hello @GeekAlfPro , 

 

Please use the below modified code to retain the null values..

 

Table.SelectRows(#"Récupération Grp", each [Genre Machine] = null or not Text.StartsWith([Genre Machine], "REMORQUE"))

 

If you find this helpful , please mark it as solution and Your Kudos are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

View solution in original post

3 REPLIES 3
AlexisOlson
Super User
Super User

Nulls have special behavior.

Text.StartsWith(null, "REMORQUE" ) = null

thus

not Text.StartsWith(null, "REMORQUE" ) = not null = null

 Since Table.SelectRows only chooses rows where the condition evaluates to true, you lose the null rows.

 

To fix this, here are a couple of options:

 

1. Handle null explicitly.

each [Genre Machine] = null or not Text.StartsWith([Genre Machine], "REMORQUE"))

 

2. Use the coalesce operator to replace null with something else like the emty string.

each not Text.StartsWith([Genre Machine] ?? "", "REMORQUE")

 

GeekAlfPro
Helper V
Helper V

Thank you @dharmendars007 that was it !

dharmendars007
Super User
Super User

Hello @GeekAlfPro , 

 

Please use the below modified code to retain the null values..

 

Table.SelectRows(#"Récupération Grp", each [Genre Machine] = null or not Text.StartsWith([Genre Machine], "REMORQUE"))

 

If you find this helpful , please mark it as solution and Your Kudos are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors