Search code examples
powerbim

how to do nested if in power bi


Hi I have this code but doesn't seem to work, can't find what the error is.

MA2 = IF(AND('Rawdata'[Country]<>"AU",'Rawdata'[Country]<>"NZ"),"",IF(or(' Rawdata'[Country]="AU",'Rawdata'[Country]="NZ"),LOOKUPVALUE(Sheet1[Manual Allocation],Sheet1[Material],'Rawdata'[SKU]),"No"))

what im trying to do is:

if country is not AU and NZ, return "", if country is AU and NZ, and the material exists in sheet1, return manual allocation column from sheet1, otherwise return "No"

thanks in advance


Solution

  • Try this one.

    MA2 = 
    IF(
       NOT 'Rawdata'[Country] IN {"AU","NZ"}
       ,""
       ,LOOKUPVALUE(
            Sheet1[Manual Allocation]
            ,Sheet1[Material]
            ,'Rawdata'[SKU]
            ,"No"
        )
    )