Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
I would like to tranform this requete in M language but i don't get it because i didn't find "if not contains" or "exclude" in this way.
Here this is the formula:
IF [Marque]="AAAAAA" THEN IF NOT [Pôle] in ("POLE 1","POLE 2","POLE 3") THEN 1
ELSE 0 END
ELSEIF [Marque]="BBBBBB " THEN
IF NOT [Pôle] in ("POLE 1","POLE 4","POLE 5",) THEN 1
ELSE 0 END
Can you help me to resolve it?
Thank you in advance,
Solved! Go to Solution.
Hi @LD1
You can add a custom column with below M code. List.Contains
if [Marque] = "AAAAAA" then ( if not List.Contains( {"POLE 1","POLE 2","POLE 3"}, [Pôle]) then 1 else 0 ) else if [Marque] = "BBBBBB" then ( if not List.Contains( {"POLE 1","POLE 4","POLE 5"}, [Pôle]) then 1 else 0 ) else null
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hi @LD1
You can add a custom column with below M code. List.Contains
if [Marque] = "AAAAAA" then ( if not List.Contains( {"POLE 1","POLE 2","POLE 3"}, [Pôle]) then 1 else 0 ) else if [Marque] = "BBBBBB" then ( if not List.Contains( {"POLE 1","POLE 4","POLE 5"}, [Pôle]) then 1 else 0 ) else null
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
If you use the filtering UI it will generate the M code for you:
You can start by adding a single filter then edit the Filter step (cogwheel icon) and switch to Advanced mode to add your sequence of conditions:
You'll see the M code for "does not contain" is: not Text.Contains
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 9 | |
| 7 | |
| 7 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 22 | |
| 14 | |
| 11 | |
| 10 | |
| 9 |