Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis

Hi,
I am practising with the Set Analysis expresion and I have a doubt.
I would like to know if it is possible calculate dinamically the value for a field from another field in the same register.
For example:
CountryContinentExportsAVG(Exports)
SpainEurope150175
FranceEurope200175
BrazilAmerica500300
ArgentinaAmerica150300
USAAmerica250300

I would like to calculate dinamically the average exports for continent in order to color those conutries that have a value higher than the average.

I have got this expression:
average_exports:=Avg({1<Continent={$(=Continent)}>} Total Exports)

This expression only works when I select a Continent (thanks to the symbol '$') but I would like to get the value for all the fields without selecting any Continent.
I think that a function like "Current(Continent)" or "this(Continent)" would be usefull but I haven't found it.
Thanks in advance,
Mario
1 Solution

Accepted Solutions
Not applicable
Author

As Jonathan says, I think this is the best approach. But using Continent instead of Country. I have attached a document with the solution.

View solution in original post

3 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Assuming you are putting this in a table with country and continent as dimensions, then try the following:

Country Average = Avg(Exports)

Content Average = Avg(TOTAL <Contintent> Exports)

Hope that helps

Jonathan

Oops, Juan is right. I have corrected the expression

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

As Jonathan says, I think this is the best approach. But using Continent instead of Country. I have attached a document with the solution.

Not applicable
Author

Thank you very much for your answer Juan Gerardo.

Your idea works perfectly.

I would like to point out that the final expresions are:

Exports = sum(Exports)

Average_Exports = Avg (TOTAL<Continent> Exports)

The value "Exports" used in the "Average_Exports" expresion is not the "Exports" expresion, is the "Exports" column. In order to clarify the example I will rewrite it:

Export_Country = sum(Exports)

Average_Export_Country=Avg(TOTAL<Continent>Exports)