Forum Discussion
Percentages Calc
Hello Power BI Community
I have information about projects, lets say the following table:
| A | B | C |
| ID | Costs | % |
| 1 | 100 | 15,87% |
| 2 | 150 | 23,81% |
| 3 | 180 | 28,57% |
| 4 | 200 | 31,75% |
| Total | 630 | 100,00% |
And I want to be able to calculate "partial %" when I apply a filter... Something like this:
| A | B | C | D |
| ID | Costs | % | Partial % |
| 1 | 20 | 15,87% | 20,00% |
| 2 | 63 | 23,81% | 42,00% |
| 3 | 79 | 28,57% | 43,89% |
| 4 | 86 | 31,75% | 43,00% |
| Total | 248 | 100,00% |
So the column "D" is the result of sum of costs of *FILTER*/sum of project costs
Any ideas?
Thank you in advance for your help!
3 Replies
- FowmySuper User
Anonymous
Try this measure. Replace the TABLE[COLUMN] with the column you use for filtering.Partial % = DIVIDE( SUM(TABLE[COST]), CALCULATE( SUM(TABLE[COST]), ALL(TABLE[COLUMN]) ) )________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂
- amitchandakSuper User
Anonymous ,partial % calculation is not clear
may be
divide(sum(Table[Cost]) , calculate(sum(Table[cost]), allselected(table)))
- AnonymousNot applicable
Hi Anonymous ,
Here are the steps you can follow:
1. Create calculcated column.
% = var _1=CALCULATE(SUM('Table'[Costs]),FILTER('Table','Table'[ID]=EARLIER('Table (2)'[ID])) ) var _2=SUM('Table'[Costs]) return DIVIDE(_1,_2)Partial % = var _1=CALCULATE(SUM('Table'[Costs]),FILTER('Table','Table'[ID]=EARLIER('Table (2)'[ID]))) var _2=CALCULATE(SUM('Table (2)'[Costs]),FILTER('Table (2)','Table (2)'[ID]=EARLIER('Table (2)'[ID]))) return DIVIDE(_2,_1)2. Result.
You can downloaded PBIX file from here.
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.