Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
Solved! Go to Solution.
Hi @Jeffrey2 ,
Try this instead:
Table.SelectRows(#"Filtered Rows1", each not Text.Contains([Comments], "Duplicate") or [Comments] = null)
Pete
Proud to be a Datanaut!
Hi @Jeffrey2 ,
Can you try to exclude the null on your filter like below?
Table.SelectRows(#"Filtered Rows1", each not Text.Contains([Comments], "Duplicate") and [Comments] <> null)
Hope this helps.
Hi @Jeffrey2 ,
Try this instead:
Table.SelectRows(#"Filtered Rows1", each not Text.Contains([Comments], "Duplicate") or [Comments] = null)
Pete
Proud to be a Datanaut!
Thanks @BA_Pete . The logic doesn't really make sense to me, but it fixed the problem.
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
Proud to be a Datanaut!
I just want to get rid of rows that have the word "Duplicate" in the Comments field. Keep all other rows. If the row had "a;dlkfja;lkdfj;ladkjf;alkjfd;lakfj" I want to keep it. If a row had "adsf;lkaj;lsfkja;lkjfadsf Duplicate" , I want it removed. If a row had null, I want to keep it.
I just think Table.SelectRows(#"Filtered Rows1", each not Text.Contains([Comments], "Duplicate")) should have been enough. To me this is a program error.
@BA_Pete to use your wording,
Table.SelectRows(#"Filtered Rows1", each not Text.Contains([Comments], "Duplicate")) should mean:
SelectRows function: give me something that doesn't contain "Duplicate".
If the comment only contains null, then it doesn't contain "Duplicate". Therefore it should be kept.
Ah, yes, I see what you mean.
However, a null doesn't contain any text either, so Text.Contains can't resolve to true or false.
As there's no text to evaluate, it has to resolve to null.
For example:
Pete
Proud to be a Datanaut!
Thank you for the explanation. That makes total sense.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
102 | |
53 | |
21 | |
12 | |
12 |