Forum Discussion
Help with TOTAL SUM
Hello, everyone!
I have the table below:
| Month | ID | Weight |
| January | 1 | 10 |
| January | 2 | 15 |
| January | 3 | 20 |
| February | 4 | 15 |
| February | 5 | 20 |
| February | 6 | 25 |
| March | 7 | 20 |
| March | 8 | 25 |
| March | 9 | 30 |
| TOTAL | 180 |
I need to create a measure to get the TOTAL WEIGHT and it stills get the correctly result, even i filter the table.
For exemple, if i filter by month = January and ID = 1 and 2, i want a measure that can get the total sum.
Something like this (column TOTAL WEIGHT is the expected result that i need):
| Month | ID | Weight | TOTAL WEIGHT |
| January | 1 | 10 | 25 |
| January | 2 | 15 | 25 |
| Total | 25 | 25 |
I've tried the measures below:
Hi Anonymous ,
You may create measure like DAX below.
TOTAL WEIGHT = CALCULATE(SUM(Table1[Weight]),ALLSELECTED(Table1)) Percent = DIVIDE(SUM(Table1[Weight]), CALCULATE(SUM(Table1[Weight]) , ALLSELECTED(Table1))) or use the measure: Percent = DIVIDE(SUM(Table1[Weight]), [TOTAL WEIGHT])Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- parry2k
Super User
Anonymous add a measure like this
Total Weight = CALCULATE ( SUM ( Table[Weight] ), ALL ( Table ) )I would β€ Kudos if my solution helped. π If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
β‘Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.β‘
- amitchandak
Super User
Anonymous ,
For weight
CALCULATE(Weight)
for sub total
CALCULATE(Weight, ALLselected(Table))
CALCULATE(Weight, allexpect(Table,Table[Month]))Also, how can you use removefilters
https://www.linkedin.com/pulse/five-recent-power-bi-functions-you-should-use-more-often-amit-chandak
- v-xicai
Community Support
Hi Anonymous ,
You may create measure like DAX below.
TOTAL WEIGHT = CALCULATE(SUM(Table1[Weight]),ALLSELECTED(Table1)) Percent = DIVIDE(SUM(Table1[Weight]), CALCULATE(SUM(Table1[Weight]) , ALLSELECTED(Table1))) or use the measure: Percent = DIVIDE(SUM(Table1[Weight]), [TOTAL WEIGHT])Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.