Forum Discussion
aravindh10
Helper I
7 years ago% cost for a order
product name qty amount cost[amount/qty] cost%[cost/total cost) a 10 1000 100 33.33333 b 20 2000 200 66.66667 total 300 100% my measure is % cost per qty = var...
- 7 years ago
hi, aravindh10
Just try this formula to create a meausre
% cost per qty = var _costytable= SUMMARIZE(abc,abc[MonthYear],"_cost1",DIVIDE([amount],[qty])) var _totaltable=SUMMARIZE(ALLSELECTED(abc),abc[MonthYear],"_cost2",DIVIDE([amount],[qty])) return DIVIDE(SUMX(_costytable,[_cost1]),SUMX(_totaltable,[_cost2]))
Result:
here is pbix file, please try it.
Best Regards,
Lin
v-lili6-msft
Community Support
7 years agohi, aravindh10
i want measure.Only available columns are qty and amount
Do you mean that [amount] and [qty] are column not measure
If so, your formula is wrong in measure
% cost per qty =
return CALCULATE(DIVIDE(DIVIDE(SUMX(abc,[amount]),SUMX(abc,Hybris[SOLD_QTY])),cost))
And what is Hybris table in the formula.
try this formula:
% cost per qty = var total_cost= DIVIDE(SUM([amount]),SUM([qty])) return CALCULATE(DIVIDE(DIVIDE(SUMX(abc,[amount]),SUMX(abc,Hybris[SOLD_QTY])),cost))
If you not your case, please share some complete sample data and expected output.
Best Regards,
Lin