cancel
Showing results for
Did you mean:
Anonymous
Not applicable

## DAX - sum the measure values in total and Not the calculated values at totals

Hi Community,

Power Bi Sample file

I need help with this measure. I got a dataset, with Items sold(ItemID), with quantity(quantity) sold for each item.

we also got a weightage(product weightage) of each itemID.

I am trying to calculate a mix indicator for all these itemIDs based upon the QTY sold and the weightage for each item.

I am calculating the values based on following formula

```mix indicator calculted =
VAR item_sum =
SUM ( 'dump data test01'[Quantity] )
VAR total_sum =
CALCULATE (
SUM ('dump data test01'[Quantity]  ),
ALL ( 'dump data test01'[ItemID] )
)
var result =
DIVIDE ( item_sum, total_sum )*SUM('dump data test01'[product weightage])

RETURN
result```

This gives me a value, which is working fine on row level. Though on the totals line, it is again calculating the mix. I on the other hand, want the total to show the sum of mix for all values, which in this example should be around 15% and not 2923%.

Report attached here with sample data and formula.

Any direction in this regard would be a great help.

Regards

emudria

1 ACCEPTED SOLUTION
Community Support

Hi @Anonymous

You can add a new measure:

`Measure 2 = SUMX(VALUES('dump data test01'[ItemID]),[mix indicator calculted])`

Best regards,

Dina Ye

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
5 REPLIES 5
Community Support

Hi @Anonymous

You can add a new measure:

`Measure 2 = SUMX(VALUES('dump data test01'[ItemID]),[mix indicator calculted])`

Best regards,

Dina Ye

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
Helper II

Hi , If i want add more columns in that measure how should i do?

Microsoft

what if I have another field along with item such as "X", will this formula still work?

Anonymous
Not applicable

THANK YOU so much Dina. works perfectly. I had spent so many hours trying to do that. Thanks again.

1 - what is happening in this formula

2 - why doesnt it work if instead of creating a new measure, I put the returned variable 'result' in this formula in same measure

ie

measure =

`SUMX(VALUES('dump data test01'[ItemID]),result)`
Frequent Visitor

awesome

Announcements

#### Join Arun Ulag at MPPC23

Get a sneak peek into this year's Power Platform Conference Keynote.

#### Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

#### Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

#### Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Top Solution Authors
Top Kudoed Authors