Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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