Forum Discussion
petrk
1 year agoNew Member
percentage calculation
Hi, please for help. I have table like this, and I need calculate values in column "per of X", it is calculated by formula "per of X = value / X" where X is sum of all values which has in name "x". ...
- Anonymous1 year ago
Hi petrk ,
I've made a test for your reference:
1\ I assuem there is a table(Table)
2\Add a measure
Per of X = Var CurrentItemValue =Max('Table'[value]) Var CurrentItemName= LEFT(SELECTEDVALUE('Table'[name]),1) Var SUMValue=CALCULATE(SUM('Table'[value]),FILTER(ALL('Table'),LEFT('Table'[name],1)=CurrentItemName)) RETURN CurrentItemValue/SUMValue3\Result
Best Regards,
Bof
petrk
1 year agoNew Member
hi Kedar_Pande ,
calculation of Total_X is OK but Per_of_X has issue. PBI doesn't allow me enter Table[value] to formula. It offer me to use just another measures which I have calcalated.
PBI error: A single value for column 'value' in table 'myTable' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.
Do you have some idea how to solve it?
Kedar_Pande
1 year agoSuper User
Updated Measure:
Per_of_X =
DIVIDE (
SelectedValue(Table[value]),
[Total_X],
0 // To handle division by zero
)
- petrk1 year agoNew Member