5 Replies Latest reply: Oct 23, 2012 9:17 AM by Paul Damen

# Sums in chart for different levels hierarchy

Hi all,

I have a hierarchy which contains States -> Regions -> Cities. I want to create 1 bar chart which shows the sum for the selected city, the sum for the region where the city belongs to and the last bar should show the total for the state.

How can I achieve this?

Thanks for the help!

Regards,

Paul

• ###### Re: Sums in chart for different levels hierarchy

I think you can do this with set analysis expressions for State and Region. A chart with no dimensions and three expression something like:

State: sum({1<State=p()>} Value)

Region: sum({1<Region=p()>} Value)

City: sum(Value)

• ###### Re: Sums in chart for different levels hierarchy

Works great! Thanks a lot!

Just out of my interest, what does the p mean and what does it do in the formula?

Regards,

Paul

• ###### Re: Sums in chart for different levels hierarchy

Other question:

I also have a chart which only consists off the cities. But they are selected in 2 different listboxes with 2 different states. In the first listbox with state 1 I selected 1 city which I want to compare with 3 cities which are selected in the listbox with state 2.

I want to make a line chart which show the 4 cities compared to each other over a couple of years.

How to a put both alternate states in 1 chart?

Regards,

Paul

• ###### Re: Sums in chart for different levels hierarchy

There's an example in the What's new in Qlikview 11 qvw. You can find that here: http://eu.demo.qlik.com/detail.aspx?appName=Whats%20New%20in%20QlikView11.qvw

See the Product Grouping tab of the qvw file.

• ###### Re: Sums in chart for different levels hierarchy

Hi,

I know that one the problem is my alternate states are x axis value so I can't put them in the expression?

Because the cities are on the X axis but should show all selected cities in both alternate states.

Regards,

Paul