Forum Discussion
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:
The calculated column is ,
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.
11 Replies
- amitchandak
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?
- Avivek
Post Partisan
- amitchandak
Super User
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
- Fowmy
Super User
Avivek
Is this post duplicated?
https://community.powerbi.com/t5/Developer/Calculated-column-for-weighted-average-does-not-work-for-few/m-p/1303737________________________
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 🙂
- Fowmy
Super User
- Fowmy
Super User
Avivek
Check this question for the solution:
https://community.powerbi.com/t5/Developer/Calculated-column-for-weighted-average-does-not-work-for-few/m-p/1303956#M25312
ThanksFowmy
- Fowmy
Super User
@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-few/m-p/1303956#M25312________________________
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 🙂
- v-xicai
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.