Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Convert DAX calculated column formula to SQL

Hi All,

 

I have two tables:
Orders table (Contains 1 row per orders placed with customer and revenue data as whole)

Order line items table (Contains brief Order data with line items bought within the order)


I used below formula to create a new column in 'Orders' table' which is referring values from 'Order Line Items' table and assigning values in new column. Now I need to create a new column in 'Orders' table itself.

 

What is the SQL equivalent of the following DAX (Power BI) Formula:

 

 

Order Table column = 
VAR Brand = CALCULATE ( SELECTEDVALUE ( 'Order Line Items'[Brand] ) )
RETURN
    IF ( 
        ISBLANK ( Brand ),
        "Mixed Order",
        Brand
    )

 

 

1 Reply

  • v-easonf-msft's avatar
    v-easonf-msft
    Community Support

    Hi, Anonymous 

    Maybe you can try the following syntax to update the data in Column 'Brand‘.

    Update TableName set xxxx where xxxx

     

    Best Regards,
    Community Support Team _ Eason