Forum Discussion
percentage calculation
- 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
Measure for Sum of X Values:
Total_X =
CALCULATE (
SUM(Table[value]),
FILTER (
Table,
LEFT(Table[name], 1) = "x" // Filters rows where name starts with 'x'
)
)
Per of X Measure:
Per_of_X =
DIVIDE (
Table[value],
[Total_X],
0 // To handle division by zero
)
If this helped, a Kudos 👍 or Solution mark would be great!
Cheers,
Kedar Pande
www.linkedin.com/in/kedar-pande
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_Pande1 year agoSuper User
Updated Measure:
Per_of_X =
DIVIDE (
SelectedValue(Table[value]),
[Total_X],
0 // To handle division by zero
)- petrk1 year agoNew Member