The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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