Percentage computation in Power BI Designer

cyrilbrd

Well-known Member
Joined
Feb 2, 2012
Messages
4,113
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
Given in Query a whole number Column representing volume produced, given another text Column giving locations
I tried to get the percentage of volume per location.
Thought of vol_produced = SUM(table[TOTAL HARVEST])/ALL(table[TOTAL HARVEST]) but this does not work.
Any idea?
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
I would prefer actual seminar or classes rather than webminar, but will definitely consider your proposal, and looking forward to read your book.
 
Upvote 0
given a table as follows:

Excel 2013
ABCDEF
1FarmProductionVolumevaluedateyear
2127162444184923/1/20152015
3148864397130533/1/20122012
4135863227197704/1/20142014
5146274164182794/1/20152015
6239043514103183/1/20152015
7246234161109433/1/20122012
8240173615143933/1/20132013
9236993329107652/1/20122012
10319351742197953/1/20142014
11349414447132124/1/20122012
12330392735113104/1/20142014
13340693662188891/1/20132013
14432792951146244/1/20132013
15420491844124174/1/20132013
16435043154139991/1/20122012
17449644468131803/1/20142014
DB



Formula used for percentage of value is :
Percentage = sum('Table'[value])/calculate(sum('Table'[value]),all('Table'))
Field ∑year set as a Slicer
Fields ∑Farm, Production, Volume and Percentage set as Table

I would like the percentage to be filtered by the slicer.
 
Upvote 0
Alright, solved with Percentage = sum('Table'[value])/calculate(sum('Table'[value]),allexcept('Table','Table'[year]))
used ALLEXCEPT as it allowed me to use the slicer and returned the correct percentage in the table.
Is this the best method?
 
Upvote 0
Thanks, registered. Now I have a concern, if I filter the table by year the percentage will only work for all years... In short it computes regardless of the filter, is ALL to be changed?

I had a similar challenge and solved it by using "ALLSELECTED" instead of "ALL" in the end:

vol_produced = SUM(table[TOTAL HARVEST])/calculate(sum(table[TOTAL HARVEST]) , allselected(table))

This "ALLSELECTED" will follow any filtering you do as far as I have used it now.

Cheers!
 
Upvote 0

Forum statistics

Threads
1,224,120
Messages
6,176,494
Members
452,733
Latest member
Gao87

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top