Forum Discussion

Raul's avatar
Raul
Icon for Post Patron rankPost Patron
7 years ago
Solved

Convert a measure into M language

Hey guys,

I have create this measure:

 

Col. Renda = IF(LEFT(SELECTEDVALUE(RendaSocietats[Concepte Renda]);5)="FFG01";LOOKUPVALUE(ServeisClients[Colaborador];ServeisClients[CodServei];"REN";ServeisClients[CodClient];SELECTEDVALUE(RendaSocietats[CodClient]));BLANK())
 
But I can't use a slicer for a measure to filter a matrix visualization. I need to convert this measure into a calculated column but I don't know how translate it into M language:
 
Col. Renda = if Text.Start(RendaSocietats[Concepte Renda],5) = "FFG01" , LOOKUPVALUE(ServeisClients[Colaborador];ServeisClients[CodServei];"REN";ServeisClients[CodClient];SELECTEDVALUE(RendaSocietats[CodClient])) else ""
 
How is the correct statement?
Thank you very much and Merry Christmas!!
  • Hi Raul

     

    You don't have to use the M. You can use the calculated column instead. Please refer to the snapshot below. The formula could be like below, which is also the DAX.

    Col. Renda =
    IF (
        LEFT ( RendaSocietats[Concepte Renda]; 5 ) = "FFG01";
        LOOKUPVALUE (
            ServeisClients[Colaborador];
            ServeisClients[CodServei]; "REN";
            ServeisClients[CodClient]; RendaSocietats[CodClient]
        );
        BLANK ()
    )
    

    Convert-a-measure-into-M-language

     

    Best Regards,
    Dale

2 Replies

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi Raul

     

    You don't have to use the M. You can use the calculated column instead. Please refer to the snapshot below. The formula could be like below, which is also the DAX.

    Col. Renda =
    IF (
        LEFT ( RendaSocietats[Concepte Renda]; 5 ) = "FFG01";
        LOOKUPVALUE (
            ServeisClients[Colaborador];
            ServeisClients[CodServei]; "REN";
            ServeisClients[CodClient]; RendaSocietats[CodClient]
        );
        BLANK ()
    )
    

    Convert-a-measure-into-M-language

     

    Best Regards,
    Dale