Forum Discussion

Sushant__08's avatar
Sushant__08
Regular Visitor
2 years ago
Solved

To add a column in Power BI using if - else functions

Dear All,   I am new to Power BI and was having issues in creating a new column.   Present table in Power BI is as below:     And I want to a new column named "EAC BQ" at the end as per ...
  • Anonymous's avatar
    Anonymous
    2 years ago

    To accommodate the updated requirements, here’s the revised DAX formula. This formula checks both if the ‘EACBQFlag’ column is not blank and contains either "Model" or "Forecast" and assigns the respective BQ column value directly. If the ‘EACBQFlag’ column is blank, it uses the ‘status’ column to determine the value:

     

    NewColumn =

    SWITCH(

        TRUE(),

        'YourTable'[EACBQFlag] = "Model", 'YourTable'[Model BQ],

        'YourTable'[EACBQFlag] = "Forecast", 'YourTable'[Forecast BQ],

        ISBLANK('YourTable'[EACBQFlag]) && 'YourTable'[status] = "Before Design Start", 'YourTable'[Target BQ],

        ISBLANK('YourTable'[EACBQFlag]) && 'YourTable'[status] = "Design Started", 'YourTable'[Forecast BQ],

        ISBLANK('YourTable'[EACBQFlag]) && 'YourTable'[status] = "FR Issued", 'YourTable'[Model BQ],

        ISBLANK('YourTable'[EACBQFlag]) && 'YourTable'[status] = "FC Issued", 'YourTable'[Model BQ],

        BLANK()

    )

    Regards,

    Chiranjeevi Kudupudi