Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Weighted average

Hello ..

I need to do a weighted average of columns.

I have several columns with very large expressions.
I'm not able to do this weighting because the columns have the SUM function.

Column 1 = sum (my term)
Column 2 = Sum (my term)
Column 3 = Sum (my term)

The weighting is as follows:

sum (Column 1 * Column 2) / sum (Column 2).

Anyone know another way to make weight?

8 Replies
tresesco
MVP
MVP

Hi,

If i have understood you, you can try Column() function OR use a column name(if its a calculated column) with double quotes like "Mycolumn".

regards, tresesco

deepakk
Partner - Specialist III
Partner - Specialist III

hi

As tresesco suggested use the column function.

(column(1) * coulmn(2)) / column(3)

Anonymous
Not applicable
Author

The problem is that I can not seem to add a column that already has within it the expression SUM. Column 1 = sum (my term) Column 2 = Sum (my term) Column 3 = Sum (my term) Is giving error if I do this: Sum (Column 1), within a column already has the words sum, plus the weighted average I need to use that expression.

johnw
Champion III
Champion III


Washington wrote:The problem is that I can not seem to add a column that already has within it the expression SUM. Column 1 = sum (my term) Column 2 = Sum (my term) Column 3 = Sum (my term) Is giving error if I do this: Sum (Column 1), within a column already has the words sum, plus the weighted average I need to use that expression.


Perhaps instead of continuing to do what you already posted in the first post and know doesn't work, you should try doing what was suggested?


Deepak Kurup wrote:(column(1) * column(2)) / column(3)


Anonymous
Not applicable
Author

John,

The suggested procedure (column (1) * column (2)) / column (2) have tested more does not work.

On average I have to be weighted by multiplying the sum divided by the sum of another column.

Sum (column (1) * column (2)) / Sum (column (2))

deepakk
Partner - Specialist III
Partner - Specialist III

hi,

Sorry its not clear. Can you let us know what should be the exact value in the final column

eg:

A B output

10 3 5

johnw
Champion III
Champion III


Washington wrote:The suggested procedure (column (1) * column (2)) / column (2) have tested more does not work.
On average I have to be weighted by multiplying the sum divided by the sum of another column.

Sum (column (1) * column (2)) / Sum (column (2))


Sorry. I guess I wasn't understanding the question. I'm still not sure if I'm understanding the question, because looking at your example, it appears that you've already solved your own problem? 62,73 looks like the correct weighted average to me. If that is NOT what you want, can you please explain what numbers you want in the final column, and how you want them computed? Because I'm lost, and it looks like everyone else is too.



Anonymous
Not applicable
Author

Hello.

As the previous comments, it was said that if I do a weighted average of the columns will work.

= sum (col1 * col2) / sum (col2).

Most failed.

When the mean field is done by returning it works the value of 62.73.