Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How make a filter in chart that shows the data of a group of the selected object?

i have a table like that:


country city population

spain    a

spain     b

spain     c

NY     d

NY     e

NY     f

NY     g

I have a chart thats shows the population when select a city, and i want another chart to shows the population in the country of the city that i selected, i don´t know how do it, i research with set analist and alternate state but i can´t get a solution,

Also i want to create another table thats shows the top citys by population of a country when i select a city of that country.

sorry for mi english

greetings

1 Solution

Accepted Solutions
sunny_talwar

May be use a variable here like this

vVar

If(GetSelectedCount(City) > 0, 'City, Country = p(Country),',

If(GetSelectedCount(Country) > 0, 'Country, Continent = p(Continent ),')

And then use this in your set analysis like this

Sum({<$(vVar)>}Measure)

Please note that the syntax editor is not going to like the variable and will show a red wiggly line, but as long as you get the output you are looking to get, don't pay too much attention to the red weggly line in your expression.

View solution in original post

9 Replies
sunny_talwar

i want another chart to shows the population in the country of the city that i selected

Assuming your expression to be Sum(Population), try Sum({<City, Country = p(Country)>} Population)

Also i want to create another table thats shows the top citys by population of a country when i select a city of that country.

Use the same expression as above and sort the cities in the descending order to see the most populated cities

Not applicable
Author

your example does work but i can´t apply to my real data, the population in mi data its not a field only, its calculated by a large expressions thats involves two fields like that

=IF(SUM({ < PEP_CLASES_COSTE='P.CERRADOS'},MES={'$(vL.MesActual)'}>}PEP_INCURRIDOS_HORAS) <> 0

or SUM({ < PEP_CLASES_COSTE={P.CERRADOS'},MES={'$(vL.MesAnterior)'}>}PEP_INCURRIDOS_HORAS) <>0,

NUM(SUM({<PEP_CLASES_COSTE={'P.CERRADOS'},MES={'$(vL.MesActual)'} >}PEP_INCURRIDOS_HORAS)/SUM({ < PEP_CLASES_COSTE={'P.CERRADOS'},MES={'$(vL.MesActual)'}>}PEP_INCURRIDOS_HORAS)

- SUM({<PEP_CLASES_COSTE={'P.CERRADOS'},MES={'$(vL.MesAnterior)'} >}PEP_INCURRIDOS_HORAS)/SUM({ < PEP_CLASES_COSTE={'P.CERRADOS'},MES={'$(vL.MesAnterior)'}>}PEP_INCURRIDOS_HORAS),'###,##%')

)

sunny_talwar

May be add this set analysis to your expression?

City, Country = p(Country)

Not applicable
Author

that works! so much thanks!, i have another issue, i want to do the same but i have a colum with continent, and 2 tables in the fist table i show stats of the selected one and in te second table i shows stats of the "father of the selected", if anyone select city in the first apears stats of the country and if select a country in the first apears stats of the contienent,
thanks and sorry for mi english.

sunny_talwar

May be use a variable here like this

vVar

If(GetSelectedCount(City) > 0, 'City, Country = p(Country),',

If(GetSelectedCount(Country) > 0, 'Country, Continent = p(Continent ),')

And then use this in your set analysis like this

Sum({<$(vVar)>}Measure)

Please note that the syntax editor is not going to like the variable and will show a red wiggly line, but as long as you get the output you are looking to get, don't pay too much attention to the red weggly line in your expression.

Not applicable
Author

hey, i do it but in the chart apears the error: "overextended the asigned memory"  i try to do it with a simple example and it makes the same error.

sunny_talwar

Do you mind sharing your simple example with us here?

Not applicable
Author

hi sunny, finally i do it using and expresion like this

IF(GetSelectedCount(ciudad)>0,Sum({<ciudad, pais = p(pais)>} poblacion),

IF(GetSelectedCount(pais)>0,Sum({<pais, continente = p(continente)>} poblacion)))

i have a problem now, in section access i give access only a data of a city , but when a user enters and show the data of her city he want to show top 10 city of her country too, but the data are filtered with the section acces so i can´t do it, any idea? so much thanks for the help!

sunny_talwar

You can pre-aggregate the data in the script... but essentially that is the only way you might be able to do this