Discussion1Replies484Views Otto_Perdeck Member since 2010 9 posts PEGA Posted: 4 years agoLast activity: 4 years 6 months ago Closed What is the preferred way to create a weighted average in reports?Hi,What is the best way to create a weighted average in a report definition? The aggregation functions include Sum, Min, Max, Average but there is no weight field. Imagine I have data like thisITEMPRICEQUANTITYA1025 5100I want to have the average price weighted by quantity, per item.The average price is 7.5, the weighted average should be (10*25 + 5*100)/(25 + 100) = 6.In SQL, this would be something likeSELECT ITEM, SUM(QUANTITY*PRICE)/SUM(QUANTITY) FROM <TABLE> GROUP BY ITEMHow do I accomplish that best in a report def?ThanksOtto Reporting ×Close popoverFacebookTwitterLinkedinEmail Copy Link Copied! Moderation Team has archived post This thread is closed to future replies. Content and links will no longer be updated. If you have the same/similar Discussion, please write a new Discussion. Posted: 4 years agonistr PEGA replied to Otto_PerdeckYou can create a sub-report which computes the two SUMs and then the main report can use pxDivide function to calculate the weighted average.