My main table costs
, is like this:
Acc Item Group Origin Money
acc1 Item1 Adm Soc 14,3
acc2 Item1 Adm Soc 1,0
acc3 Item2 Pers Bnk 4,5
acc4 Item2 Pers Bnk -45,2
acc5 Item3 Amort Adj -745,7
acc6 Item4 Adm Adj 67,8
acc7 Item4 Amort Bnk 87,0
acc8 Item4 Adm Soc -200,0
acc9 Item5 Adm Bnk -34,0
acc10 Item6 Pers Bnk -23,0
acc11 Item4 Adm Adj -7,8
acc12 Item4 Adm Adj -745,0
acc13 Item4 Adm Adj -82,0
acc14 Item4 Adm Adj -14,0
acc15 Item4 Adm Adj -2,0
I have no other tables made and related to the main one. I'm calculating things in DAX with filters. I made This measure: Var_neg_adm_adj (Var_neg = Negative variations) to brings the negative money values with this filters in the columns:
Group
= Adm
Origin
=Adj
Money < 0
.
Var_neg_adm_adj= CALCULATE(SUM(Costs[Money]),
FILTER(Costs, Cost[Group]="Adm"),
FILTER(Costs), Cost[Origin]="Adj"
FILTER(Costs), Cost[Money] < 0)
)
So i got this:
Acc Item group Origin Money
acc11 Item4 Adm Adj -7,8
acc12 Item4 Adm Adj -745,0
acc13 Item4 Adm Adj -82,0
acc14 Item4 Adm Adj -14,0
acc15 Item4 Adm Adj -2,0
Total -850,8
What I want: A column in DAX with the percentages/weights that each row contributes to the summed total.
Acc Item group Origin Money Percentage
acc11 Item4 Adm Adj -7,8 0,9%
acc12 Item4 Adm Adj -745,0 87,5%
acc13 Item4 Adm Adj -82,0 9,4%
acc14 Item4 Adm Adj -14,0 1,64%
acc15 Item4 Adm Adj -2,0 0,2%
Total -850,8 100%
You can use ALLSELECTED
to get the total.
Percentage =
DIVIDE(
[Var_neg_adm_adj],
CALCULATE([Var_neg_adm_adj], ALLSELECTED('Costs'))
)