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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Avivek
Post Partisan
Post Partisan

Calculated column for weighted average does not work for few rows

I had created a calculated column for total weight calculation which was (days difference* payment recieved). This calculated column works fine for few rows fetching the correct value on multiplication but few rows the multiplication values do not match. let me share the screenshot for it:

Avivek_1-1597747091557.png

 

The calculated column is ,

Weight = RECEIVABLES[Days Diff]*RECEIVABLES[PAYMENT_AMOUNT]
 
Since it did not fetch the value I needed I created a new measure
Weight(measure)= CALCULATE(SUMX(RECEIVABLES,RECEIVABLES[Days Diff]*VALUE(sum(RECEIVABLES[PAYMENT_AMOUNT]))))
 
Though the measure works well but then the issue is that the total is not correct.
I need the total weight for another measure to fetch  me the weighted average days.

 

1 ACCEPTED SOLUTION
v-xicai
Community Support
Community Support

Hi @Avivek ,

 

You may create a new measure like DAX below to get the correct total.

 

Weight(measure)_New=

var _table = SUMMARIZE(RECEIVABLES, RECEIVABLES[Month & Year],"_Value", [Weight(measure)] )

return
IF(HASONEVALUE(RECEIVABLES[Month & Year]), [Weight(measure)], SUMX(_table,[_Value]))

 

Best Regards,

Amy 

 

Community Support Team _ Amy

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

11 REPLIES 11
v-xicai
Community Support
Community Support

Hi @Avivek ,

 

You may create a new measure like DAX below to get the correct total.

 

Weight(measure)_New=

var _table = SUMMARIZE(RECEIVABLES, RECEIVABLES[Month & Year],"_Value", [Weight(measure)] )

return
IF(HASONEVALUE(RECEIVABLES[Month & Year]), [Weight(measure)], SUMX(_table,[_Value]))

 

Best Regards,

Amy 

 

Community Support Team _ Amy

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

Fowmy
Super User
Super User

@Avivek 

 

Try this

Weight(measure)= 
SUMX(
   RECEIVABLES,
   RECEIVABLES[Days Diff]* RECEIVABLES[PAYMENT_AMOUNT]
)

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube, LinkedIn 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

@Avivek 

Check this question for the solution:
https://community.powerbi.com/t5/Developer/Calculated-column-for-weighted-average-does-not-work-for-...

Thanks

Fowmy

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

@Fowmy thankyou but it may be the image problem, the data does not have decimal, the format is same for the whole colum, PFA one such screenshot.Capture.PNG

@Avivek

Check this post, you will find the issue with your data:
https://community.powerbi.com/t5/Developer/Calculated-column-for-weighted-average-does-not-work-for-...

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube, Linkedin

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Fowmy
Super User
Super User

@Avivek 


Is this post duplicated?

https://community.powerbi.com/t5/Developer/Calculated-column-for-weighted-average-does-not-work-for-...

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube, LinkedIn 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Yes @Fowmy 

amitchandak
Super User
Super User

@Avivek , it should be

Weight(measure)= CALCULATE(SUMX(RECEIVABLES,RECEIVABLES[Days Diff]*RECEIVABLES[PAYMENT_AMOUNT]))

 

Can you share sample data and sample output in table format?

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak ,

I had tried the same measure but it gives me the same error as the calculated column

Avivek_0-1597749125435.png

 

@Avivek , Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Multiplication should be done at row level and division at aggregated level

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak , please find the link-

But this file I have taken it from the excel after filtering the confidential part but i do not see the total issue in the measure here but I can see that issue in the report when it is connected to the model, let me share the screenshot with the same data from the report connected to the model
 
-Avivek_0-1597775116431.png

 

 
 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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
Top Kudoed Authors