cancel
Showing results for
Did you mean:
Highlighted Post Partisan

## Calculate the sum of a measure

Hi,

I have a column of sales volumes with the rows being branch numbers.

I'd like to a calculated measure showing the "% weighting " versus the total. I know I can use "Show Value As -> % of Grand Total" but I'd like the result in a calculated measure that I can use elsewhere.

Please can you tell me how to calculate the sum of the volumes? (in order to allow me to calculate the % weighting)

Thanks,

CM

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted Super User II

## Re: Calculate the sum of a measure

for a measure (assuming it's sum of sales) syntax would look like this

```% weighting all selected =
RETURN
DIVIDE(CurrentSales,AllSelectedSales)```

without sample data & measure syntax from your side I cannot provide more specific info

Thank you for the kudos 🙂

Proud to be a Datanaut!

4 REPLIES 4
Highlighted Super User II

## Re: Calculate the sum of a measure

depending whether you need the weight to be as per overall total or currently selected you may select between the 2:

```% weighting all selected =
VAR CurrentSales = SUM('Table'[Sales Volume])
VAR AllSelectedSales = CALCULATE(SUM('Table'[Sales Volume]),ALLSELECTED('Table'))
RETURN
DIVIDE(CurrentSales,AllSelectedSales)```
```% weighting all=
VAR CurrentSales = SUM('Table'[Sales Volume])
VAR AllSales = CALCULATE(SUM('Table'[Sales Volume]),ALL('Table'))
RETURN
DIVIDE(CurrentSales,AllSales)```
Thank you for the kudos 🙂

Proud to be a Datanaut!

Highlighted Post Partisan

## Re: Calculate the sum of a measure

Is there a way to sum calculated measures? (I think you are summing calculated fields?)

Thanks

Highlighted Super User II

## Re: Calculate the sum of a measure

for a measure (assuming it's sum of sales) syntax would look like this

```% weighting all selected =
RETURN
DIVIDE(CurrentSales,AllSelectedSales)```

without sample data & measure syntax from your side I cannot provide more specific info

Thank you for the kudos 🙂

Proud to be a Datanaut!

Highlighted Post Partisan

## Re: Calculate the sum of a measure

Brilliant, thank you Stachu This may lead to a follow up question but I'll start another thread...

Announcements #### Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members. #### Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start. #### Galleries

Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries! Top Solution Authors
Top Kudoed Authors
Users online (681)