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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
yolandecastle
Regular Visitor

Calculated Measure not Summing correctly

hi there

newby to PowerBi here.

I need to calculate a weighted average on the age of product consignments sold over several days. I get it right on excel with the sumproduct formula. But o my, it's not working on Bi. The values in yellow is what i get on excel and what my answer should be.

 

yolandecastle_0-1645544425767.png

however,

in PowerBi i get the following:

yolandecastle_1-1645544567287.png

my measures are as follows:

a1DAY_TOTAL = CALCULATE(SUM(SALES[SALES_QTY]),ALL(SALES[SALES_DATE]),FILTERS(SALES[DEL_GRN]))

 

a2QTY_PERC = DIVIDE(SUM(SALES[SALES_QTY]),[a1DAY_TOTAL])

 
a3AVE_AGE = AVERAGE(SALES[a0AGE])
 
a4AVE_PERC = ([a3AVE_AGE]*[a2QTY_PERC])
 
.....I need a4AVE_PERC to have a total of 4.9. 
 
I would appreciate your help!
1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @yolandecastle ;

You could create measure as follows:

 

averge = 
var _a=SUMMARIZE('Table',[DEL_ NOTE ],[SALES_ _QTY],"1", SUM([SALES_ _QTY])*SUM([AGE IN DAYS]))
return DIVIDE( SUMX(_a,[1]),SUM([SALES_ _QTY]))

 

The final output is shown below:

vyalanwumsft_0-1645757766371.png

 


Best Regards,
Community Support Team_ Yalan Wu
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

1 REPLY 1
v-yalanwu-msft
Community Support
Community Support

Hi, @yolandecastle ;

You could create measure as follows:

 

averge = 
var _a=SUMMARIZE('Table',[DEL_ NOTE ],[SALES_ _QTY],"1", SUM([SALES_ _QTY])*SUM([AGE IN DAYS]))
return DIVIDE( SUMX(_a,[1]),SUM([SALES_ _QTY]))

 

The final output is shown below:

vyalanwumsft_0-1645757766371.png

 


Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.