Forum Discussion

nj-matt's avatar
nj-matt
Helper I
4 years ago
Solved

Dax to sum multiple rows within same table

I have a table with many rows of detail that I need to maintain, but I also need sum for multiple rows to generate ROI.

 

Promotion #Gross SalesGross Sales (Promo)
123$100$300
123$200$300
124$50$50

 

I need dax to sum up the total of both lines of gross sales on promo 123 to the aggregate Gross Sales (Promo) line.

 

Help?

  • Hi, nj-matt 

    If you just want to sum values by group, please use formula as below:

    measure/calculated column:

    Gross Sales (Promo) = CALCULATE(SUM('Table'[Gross Sales]),ALLEXCEPT('Table','Table'[Promotion #]))

     

    Best Regards,
    Community Support Team _ Eason
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • jaipal's avatar
    jaipal
    Resolver III

    nj-matt try this 

    Measure = SUMX(VALUES('Table'[Promotion]), CALCULATE(SUM('Table'[Gross sales (Promo)])))
  • v-easonf-msft's avatar
    v-easonf-msft
    Community Support

    Hi, nj-matt 

    If you just want to sum values by group, please use formula as below:

    measure/calculated column:

    Gross Sales (Promo) = CALCULATE(SUM('Table'[Gross Sales]),ALLEXCEPT('Table','Table'[Promotion #]))

     

    Best Regards,
    Community Support Team _ Eason
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.