Forum Discussion
davidz106
4 years agoHelper III
Dividing within the same column
Hi, I have a table with 4 columns ID Factor Component Quantity name1 1 A 0,5 name1 0 B 2 name1 1...
- Anonymous4 years ago
davidz106 UPDATED - check this out.
Percentage_ = VAR DValue = CALCULATE(SUM('Divide'[Quantity]),FILTER(ALLEXCEPT('Divide','Divide'[ID]),'Divide'[Component] ="D")) RETURN IF(SUM('Divide'[Factor]) = 1,SUM('Divide'[Quantity])/DValue,0)Accept the solution if it fulfills your need.
Anonymous
4 years agoNot applicable
davidz106 Can you show what is the desired output you are expecting.
Anonymous
4 years agoNot applicable
davidz106 UPDATED - check this out.
Percentage_ =
VAR DValue = CALCULATE(SUM('Divide'[Quantity]),FILTER(ALLEXCEPT('Divide','Divide'[ID]),'Divide'[Component] ="D"))
RETURN
IF(SUM('Divide'[Factor]) = 1,SUM('Divide'[Quantity])/DValue,0)
Accept the solution if it fulfills your need.
- davidz1064 years agoHelper III
Thank you very much. This is exactly what I was looking for.
- davidz1064 years agoHelper III
Althogh if I define percentage as measure your code works perfect. If I define percentage as column it does not. I find it a bit curios. I do not really need it to work as a column so it's all good.
- davidz1064 years agoHelper III
Is there a way to define this as a new column in M language? I am having some probles with DAX solution due to table relations.