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
aravindh10
Helper I
7 years ago| field is available as Measure | field is available as Measure | what I got using the measure which i got from the community | cost | cost% | Required Measure | |
| MonthYear | Amount | Qty | % cost per qty | Amount/Qty | cost/total cost | % cost per qty |
| 19-May | $20,379,005 | 38405 | 1.026826333 | 530 | 530/1525 | 34% |
| 19-Jun | $11,952,378 | 24142 | 0.958038303 | 495 | 495/1525 | 32% |
| 19-Apr | $4,957,268 | 9610 | 0.998207489 | 515 | 515/1525 | 33% |
| 1525 | 100% |
v-lili6-msft
Community Support
7 years agohi, 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