Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
aravindh10
Helper I
Helper I

% cost for a order

product nameqtyamountcost[amount/qty]cost%[cost/total cost)
a10100010033.33333
b20200020066.66667
  total300100%

my measure is

% cost per qty =
var total_cost= DIVIDE([amount],[qty])
return CALCULATE(DIVIDE(DIVIDE(SUMX(abc,[amount]),SUMX(abc,[SOLD_QTY])),cost))
 
please help me with the correct measure
1 ACCEPTED SOLUTION

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:

7.JPG

here is pbix file, please try it.

 

Best Regards,

Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-lili6-msft
Community Support
Community Support

hi, @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 =
var total_cost= DIVIDE([amount],[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

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 field is available as Measurefield is available as Measurewhat I got using the measure which i got from the communitycostcost%Required  Measure
MonthYearAmountQty% cost per qtyAmount/Qtycost/total cost% cost per qty
19-May$20,379,005384051.026826333530530/152534%
19-Jun$11,952,378241420.958038303495495/152532%
19-Apr$4,957,26896100.998207489515515/152533%
    1525 100%

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:

7.JPG

here is pbix file, please try it.

 

Best Regards,

Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ZunzunUOC
Resolver III
Resolver III

You could use a calculated column like this:

 

% cost per qty = cost[cost[amount/qty]]]/SUM(cost[cost[amount/qty]]])

 

Best Regards,
Miguel

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

i want measure.Only available columns are qty and amount

Please, review your raw data, the second row is wrong and if cost would equal for two row.

 

And the other hand, calculated columns are the best way to get your goal.

 

Column cost would be:

 

Cost = cost[amount]/cost[qty]

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors