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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculate Avg grouped by 2 dimensions

Hi, i need to obtein the average grouped by Period and Country like show the following table. Can you help me?

Thanks in advance

chart.PNG

1 Solution

Accepted Solutions
swuehl
MVP
MVP

It looks more like a percentage share of products number than an average value to me?

If this is what you want, I think the last column is calculated like

= sum(Products) / sum(total Products) *100

and the second last column like

= sum(Products) / sum(total<Period, Country> Products) * 100

in a table chart with Period, Country and Type as dimensions - wait that won't explain your two feb-11 / Spain / D lines, how do you separate these two lines? There seems to be some dimension missing here.

View solution in original post

4 Replies
swuehl
MVP
MVP

Hi,

it seems I have some problems reading your table. The last column is what you want to achieve?

In your sample data,  I would expect to see the same value for any given combination of Period and Country, if you want to group by these 2 dimensions.

It looks to me that your last column is an average grouped by 3 dimensions (Period, Country and Type or Products).

What is the field / value you want to average? If you could post some lines of raw data, this might help in finding a solution for you.

edit:

If you just want to give it a try:

=avg(total<Period, Country> Value)

Not applicable
Author

Hi swuehl, the last column is the normal average result. So it sum 100%, but i need the result of previous column: Avg (Period/Country) which sum 100% by each Period & Country.

Thanks for your attention

swuehl
MVP
MVP

It looks more like a percentage share of products number than an average value to me?

If this is what you want, I think the last column is calculated like

= sum(Products) / sum(total Products) *100

and the second last column like

= sum(Products) / sum(total<Period, Country> Products) * 100

in a table chart with Period, Country and Type as dimensions - wait that won't explain your two feb-11 / Spain / D lines, how do you separate these two lines? There seems to be some dimension missing here.

Not applicable
Author

Thanks swuehl, your solution works fine !!

I'm sorry, the two feb-11 / Spain / D lines was a mistake when typing, one line would be C.