Forum Discussion

Buyer_JC78's avatar
Buyer_JC78
Regular Visitor
2 years ago
Solved

PowerBI Dax Formula, returning text from column with 3 different return options

Hi, 

I am struggling to find the right formula to return the text I need to a new column in PowerBI.

This is what I need

If Column A = "z" then return "Opex"

If Column A = isblank then return "tbc"

If Column A = not "z" and not "blank" then return "Capex"

 

Can anyone help please?

  • Hi, in the power query, add a custom column and the following
    if [Column A] = "z" then "Opex" else if [Column A] = "" then "tbc" else if [Column A] <> "z" then "Capex" else if [Column A] <> "" then "Capex" else "Capex")

     

    or you can use DAX, add a column

    if(Table1[Column A] = "z", "Opex",if([Column A] = "", "tbc", if( [Column A] <> "z" || [Column A] <> "" , "Capex")))



1 Reply

  • olgad's avatar
    olgad
    Resident Rockstar

    Hi, in the power query, add a custom column and the following
    if [Column A] = "z" then "Opex" else if [Column A] = "" then "tbc" else if [Column A] <> "z" then "Capex" else if [Column A] <> "" then "Capex" else "Capex")

     

    or you can use DAX, add a column

    if(Table1[Column A] = "z", "Opex",if([Column A] = "", "tbc", if( [Column A] <> "z" || [Column A] <> "" , "Capex")))