Forum Discussion

cristianml's avatar
cristianml
Icon for Post Prodigy rankPost Prodigy
5 years ago
Solved

Costume formula issue in Editor

Hi,

 

I need to create a custom column with the following formula in the query editor but it gives me an error :

IF([#"Type / Cost Center Career Track"]="Subcontractor","Subcontractor",IF([#"Type / Cost Center Career Track"]="Unassigned","Unassigned",CONCATENATE(0,[Level])))

 

 

 

Could you plese help me to write the correct formula ? I know this is DAX but I need the same in the editor

 

The Assumptions are:

 

IF "Type / Cost Center Career Track" is iqual to Subcontractor THEN Subcontractor  

IF "Type / Cost Center Career Track" is iqual to Unassigned THEN Unassigned

ELSE

concatenate 0 with "level" column

 

 

Thanks !!

 

 

 

  • Hi, cristianml ;

    You could modify it as follows:

     

    = Table.AddColumn(#"Replaced Value", "Custom", each if [#"Type/Cost Center Career Track"] = "Subcontractor" then "Subcontractor" else if [#"Type/Cost Center Career Track"] = "Unassigned" then "Unassigned" else "0"&[Level])

     

    "If " in power query : if ...then... else;

    "If" in dax: IF(<logical_test>, <value_if_true>[, <value_if_false>])

    The final output is shown below:

    Best Regards,
    Community Support Team_ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

  • HotChilli's avatar
    HotChilli
    Icon for Community Champion rankCommunity Champion

    I haven't looked at the logic but that's DAX and you're putting it in the Power Query editor. Create a column or measure in Powerbi front end for that.

  • v-yalanwu-msft's avatar
    v-yalanwu-msft
    Icon for Community Support rankCommunity Support

    Hi, cristianml ;

    You could modify it as follows:

     

    = Table.AddColumn(#"Replaced Value", "Custom", each if [#"Type/Cost Center Career Track"] = "Subcontractor" then "Subcontractor" else if [#"Type/Cost Center Career Track"] = "Unassigned" then "Unassigned" else "0"&[Level])

     

    "If " in power query : if ...then... else;

    "If" in dax: IF(<logical_test>, <value_if_true>[, <value_if_false>])

    The final output is shown below:

    Best Regards,
    Community Support Team_ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.