Forum Discussion

SativagateMTX's avatar
SativagateMTX
Copper Contributor
Aug 22, 2022

formule vers langage M

 Bonjour 

J'ai un problème a le code M je ne suis pas doué pour les Expression de langage M ,mais 

de base le code est sensé faire et remplacé ma formule dans la colonne E Cellule E2 a E40 

SI.CONDITIONS(GAUCHE($D2;3)=”sol”;”SOL”;GAUCHE($D2;3)=”PAP”;”PAP”;$D2>0;”GARE”);””)

dans un exemple de donné comme suite. 

Emplacement résultat
9 GARE
sol15 SOL
PAP PAP

 

  • Riny_van_Eekelen's avatar
    Riny_van_Eekelen
    Platinum Contributor

    SativagateMTX 

    Without knowing what exactly you are trying to achieve, perhaps this M-code will help you on your way.

    = Table.AddColumn(#"Changed Type", "Custom", each
            if Text.StartsWith ([Column1], "sol") then "SOL" else 
            if Text.StartsWith ([Column1], "PAP") then "PAP" else 
            if Number.FromText ([Column1]) > 0 then "GARE" else 
            null
    )

     

    The picture below shows the "formula" in action.

     

Resources