Forum Discussion

mumair's avatar
mumair
Helper I
9 years ago
Solved

How to Group By?

How do I group my data? Let's say for example, I have data with these columns: managers, months, and sales. I want the total sales per month per manager. How would I write this in DAX?
  • v-huizhn-msft's avatar
    v-huizhn-msft
    9 years ago

    Hi mumair,

    You can create a new table using SUMMARIZE function by New Table under Modeling on home page->type the following formula.

    Group-by-table=SUMMARIZE(Table,Table[Month], Table[Managers],"Total Sales", sum(Table[sale]))  
    


    You also can create a new calculated column using the formula.

    Total-sales-column = CALCULATE(SUM(Table[sales]),ALLEXCEPT(Table,Table[Month],Table[Managersr]))
    


    Thanks,
    Angelia