Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Need Help in a calculated field

Hi All,

I want to replicate the below formula in Power bi , Can anyone please help me .

IF [Alliance Fit]="General Fit" THEN [Play Fit]
ELSEIF [Alliance Fit]="Azure Alliance Fit" THEN [Azure Alliance Fit]
ELSEIF [Alliance Fit]="GCP Alliance Fit" THEN [GCP Alliance Fit]
ELSE [Play Fit]
END

Thanks & Regrards
Shiv Kumar

  • I presume you are asking for a DAX formula. You can use SWITCH

    = SWITCH([Alliance Fit],"General Fit",[Play Fit],"Azure Alliance Fit",[Azure Alliance Fit],"GCP Alliance Fit",[GCP Alliance Fit],[Play Fit])

3 Replies

  • Vijay_A_Verma's avatar
    Vijay_A_Verma
    Most Valuable Professional

    I presume you are asking for a DAX formula. You can use SWITCH

    = SWITCH([Alliance Fit],"General Fit",[Play Fit],"Azure Alliance Fit",[Azure Alliance Fit],"GCP Alliance Fit",[GCP Alliance Fit],[Play Fit])
  • wdx223_Daniel's avatar
    wdx223_Daniel
    Community Champion

    NewCalculatedColumn=SWITCH(TRUE(), [Alliance Fit]="General Fit",[Play Fit],
    [Alliance Fit]="Azure Alliance Fit", [Azure Alliance Fit],
    [Alliance Fit]="GCP Alliance Fit" ,[GCP Alliance Fit],
    [Play Fit])

  • mussaenda's avatar
    mussaenda
    Community Champion

    Hi Anonymous ,

     

    If you want in Power Query, 

    Please try below:

    try
    if Text.Upper([Alliance Fit]) = "GENERAL FIT"
    then [Play Fit]
    else 
    
    if Text.Upper([Alliance Fit]) = "AZURE ALLIANCE FIT"
    then [Azure Alliance Fit]
    else 
    
    if Text.Upper([Alliance Fit]) = "GCP ALLIANCE FIT"
    then [GCP Alliance Fit]
    else 
    [Play Fit]
    
    otherwise [Play Fit]