sqlpowerbidax

DAX SYNTAX for new table


From the modelling tab, I want to add a new table that calculates the sum of revenue grouping it by each customer id. The sql syntax for the query would look something like this:

SElECT SUM(REVENUE)
FROM ONlINE_RETAIl
GROUP BY CUST_ID

What is the DAX equivalent syntax?


Solution

  • Thanks @David Browne,

    Thank you for the first tip!

    But the issue is I was trying to create a column and your query gives a table context. But thankfully I finally was able to create the below query that works based on the answer you provided! Thank you so much!

    CustomerRevenueTable = 
    SUMMARIZE(
        '''Online Retail2$''',
        '''Online Retail2$'''[CustomerID],
        "Total Revenue", SUM('''Online Retail2$'''[REVENUE])
    )