IBM Support

Calculating weighted average with Query Studio

Troubleshooting


Problem

How would you create a calculation in Query Studio with a weighted average formula in Query Studio? Assuming that you have two facts, e.g. Revenue and Quantity, the weighted average will be Sum(Revenue*Quantity)/Sum(Quantity) which means: w.a. = ((r1*q1) + (r2*q2) + ... + (rn*qn))/(q1 + q2 + ... + qn) r : a value for Revenue q : a value for Quantity By default, when you create a calculation in Query Studio like (Quantity*Revenue)/Quantity, the expression will be like : total(Quantity)*total(Revenue)/total(Quantity).

[{"Product":{"code":"SSEP7J","label":"Cognos Business Intelligence"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":"Query Studio","Platform":[{"code":"PF033","label":"Windows"}],"Version":"10.2.2;10.2.1","Edition":"","Line of Business":{"code":"LOB76","label":"Data Platform"}},{"Product":{"code":"SSEP7J","label":"Cognos Business Intelligence"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":" ","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB76","label":"Data Platform"}},{"Product":{"code":"SS6G84","label":"IBM Cognos Analytics on Cloud"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":" ","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB76","label":"Data Platform"}}]

Log InLog in to view more of this document

This document has the abstract of a technical article that is available to authorized users once you have logged on. Please use Log in button above to access the full document. After log in, if you do not have the right authorization for this document, there will be instructions on what to do next.

Document Information

Modified date:
08 May 2025

UID

swg21991343