M-Code Filter other solution?

Dear Enterprise Team,

I need advice and small help, please.

I build my report that had a lot of steps applied in data transformations when I load new data I notice that I don’t receive the correct results due to one of the step applied steps:

In the applied steps I selected Acc Code and filter the code that does not equal to * or 2551-4110 and then I have select Reference column to only filter where value = null or NonRecovTax.

Later on, I noticed that the formula applied the rest of the m code automatically for “reference column” and if I load new data the end results will not be the same, as in the new data the reference can be unique or duplicate/ repeated values text, etc but since the m-code remembers only the first source of data the row filter using the applied steps for the first source.

In order to sort this use, I could create an custom column with if statements
If account <> * or account<> 2551-4110 and reference null or reference = nonrecovertax give me 1 else 0. Then I could filter by a new custom column which should always retain the correct results if I would load a new data source.

My question is there any other solution such as the m-code filter? to ensure the m-code will filter always the data if ([Acct Code] <> “*” and [Acct Code] <> “2551-4110”) and ([Reference] = null or [Reference] = “:NonRecovTax”) ?

As I mentioned the reference column will aways contain unique or different values/texts and I just need to focus on the data that contains reference null or “:NonRecovTax”

Table.SelectRows(#“Removed Columns1”, each ([Acct Code] <> “*” and [Acct Code] <> “2551-4110”) and ([Reference] = null or [Reference] = “:NonRecovTax”) and ([Notes] <> null and [Notes] <> “”":BB sebdk14 /144 INTERNAL CUSTOMER TRANSFER""" and [Notes] <> “:BB sebdk14 /153 PostNord Group AB” and [Notes] <> “Affaldshåndtering Q1 2020” and [Notes] <> “Affaldshåndtering Q2 2020” and [Notes] <> “CBRE PM fee Q1 2020” and [Notes] <> “DHL Aviation (t0037875)” and [Notes] <> “Dobbelt betaling af Nyrup Hansen - Aconto 02 ifølge bilag” and [Notes] <> “Grøntpleje Q1 2020” and [Notes] <> “Grøntpleje Q2 2020” and [Notes] <> “Intercompany overførsel vedr. SC” and [Notes] <> “NYRUP HANSEN F 2173 MONEY RETURN 24/04” and [Notes] <> “Omp KOBENHAVNS LUFTHAVNE A/S” and [Notes] <> “Quick refund DHL Aviation” and [Notes] <> “Serviceaftale elevatorer Q1 2020” and [Notes] <> “Serviceaftale elevatorer Q2 2020” and [Notes] <> “Tbf Affaldshåndtering Q1 2020” and [Notes] <> “Tbf CBRE PM fee Q1 2020 - betales af Intertrust og er ikke med i vores regnskab” and [Notes] <> “Tbf Forsikring afsat iht. budget 2018” and [Notes] <> “Tbf Grøntpleje Q1 2020” and [Notes] <> “Tbf Property insurance according to budget Q4” and [Notes] <> “Tbf Q4 Fees CBRE” and [Notes] <> “Tbf Q4 Fees CBRE - betales af Intertrust og er ikke med i vores regnskab” and [Notes] <> “Tbf Serviceaftale elevatorer Q1 2020” and [Notes] <> “Tbf Vicevært Q1 2020” and [Notes] <> “Udgiftsførelse af moms vedrørende servicering af ventilationsanlæg” and [Notes] <> “Vicevært Q1 2020” and [Notes] <> “Vicevært Q2 2020”)),


Hi Matty,

I would suggest creating and using List filters… let me explain that with an example.

First create the lists, items to exclude

and another list with items to include

Then implementing both filters would look something like this.

Here’s a sample in XLSX and PBIX
List filters.xlsx (165.6 KB) List filters.pbix (15.1 KB)

I hope this is helpful.


@Melissa Thank you very much, I think this will work I will check it on Monday :),

Have a great weekend!

Once again thank you,