Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
jachopzon
Partner - Contributor
Partner - Contributor

Weighted age per year

Hi all,

I need to get weighted age per year in a straight table. I have tried a lot of ways but I do not get the weighted age per year (my dimension), only the total weighted age for my data. I hope that someone can help me to bring some light over my problem.

Dimension:

Year

Fields:

Age

WEIGHT

Sum(Total Age * Aggr(Sum(WEIGHT), Age)) / Sum(Total Aggr(Sum(WEIGHT), Age))

Thanks a lot in advance!

Best,

Sussi

2 Replies
anbu1984
Master III
Master III

Can you provide sample data and expected output

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

If Year is the chart dimension, you need to include it in the Aggr statements, something like:

     Sum(Aggr(Age * Sum(WEIGHT), Age, Year)) / Sum(Total Aggr(Sum(WEIGHT), Age, Year))

The correct answer will depend on your data model so if this does not work, I suggest that you post a sample.

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein