Forum Discussion
"Does Not Contain" is picking up null values
I have a power query table that I have narrowed down to two records, one the original and one that is close to being a duplicate (the Comments column).
In record one, the Comments field is null. In record two, the field says "Duplicate Initiation".
I added a step that says Table.SelectRows(#"Filtered Rows1", each not Text.Contains([Comments], "Duplicate")).
However, it's removing both records instead of just keeping the record with the null in comments. How do I keep the record with the null value and remove the record with the "Duplicate" word.
Hi Jeffrey2 ,
Try this instead:
Table.SelectRows(#"Filtered Rows1", each not Text.Contains([Comments], "Duplicate") or [Comments] = null)Pete
8 Replies
- BA_PeteSuper User
You're giving the the SelectRows function a choice: either give me something that doesn't contain "Duplicate", or give me a null.
However, this is a very narrow example-case, so the logic may fall over with a broader sampleset.
For example, what happens when you have rows that otherwise match, but one has "Whatever" in [comments], and the other has null. Both of these rows will be retained using this logic - is this what you want/need?
Pete