3 Replies Latest reply on Nov 2, 2018 4:25 AM by Ankit Bansal

# Aggregation and average problem on media studies

Hi,

I'm working on a study of french radios.

One of my graph is about politicians invited on air.

My data looks like :

One person can be a member of different parties at the same time. (a permanent party and a temporary party for a specific election for example)

The age is relative to the date of the invitation.

I have a problem with the aggregation of ages. I would like to get the average Age of people invited on all or on a specific radio.

As I possibly have multiple lines for one invitation (invitation 2 for example), a simple average gives an erroneous value.

For the example data, the right value should be : Average age : (20 + ( (60 + 60  ) /2 ) + 61 + 40 ) / 4 = 45,25

But a simple average on all lines gives = (20+60+60+61+40) / 5 = 48,2

How could I do that ?

Thanks a lot.

PS :

Here is my final graph :

At the top you can choose a radio

In the middle you can see the names of politicians and the number of invitations (the colors indicate the party they are member of )

At the bottom the weight of each party.

• ###### 1. Re: Aggregation and average problem on media studies

Raphael,

You can use LOD to solve this:

create a field as as

{include persons : avg(age)}

Then use this field to find final average.

Basically your data will be first aggregated at person level (like 60+60/2). Then overall average you will get on top of that.

Thanks,

AB

• ###### 2. Re: Aggregation and average problem on media studies

Hi,

Thanks a lot for your help and reactivity.

I solved the problem two minutes ago thanks to this topic :

I think it almost the same. I'll have a look to your proposal.

Have a nice day.

• ###### 3. Re: Aggregation and average problem on media studies

Yeah its same, you can use fixed LOD also.