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

List Box & Bar Chart Expression Not Linked

Hello,

I'm in need of some help with controlling a Bar Chart with a List Box. I'm trying to get a Bar Chart with 3 separate bars, one for each group as can be seen in the List Box breakdown below. What I would like to happen is to select one or more of the 3 values in the list box (North America, EMEA or Asia & Others) and have the corresponding bar appear/disappear depending on what is selected. There seems to be a disconnect between the expression as a field in the List Box and the corresponding expressions in the Bar Chart. Regardless of what is selected in the List Box, the Bar Chart remains the same showing all 3 bars. The only item that reacts to the List Box selection is the simple expression "count(WRLD_RGN)" which counts all values and puts them into 1 bar instead of breaks them into separate bars as I would like. This is not what I want, but I wanted to see if anything reacted to the list box so this was just a test bar of sorts. Any help is appreciated!

My List Box has the following expression as a field in order to group the actual field values:

=if(WRLD_RGN='Lat.Amer','North America'

,if(WRLD_RGN='N.Amer','North America'

,if(WRLD_RGN='Caribbean','North America'

,if(WRLD_RGN='Africa','EMEA'

,if(WRLD_RGN='E.Eur','EMEA'

,if(WRLD_RGN='Europe','EMEA'

,if(WRLD_RGN='MiddleEast','EMEA'

,if(WRLD_RGN='Oceania','Asia & Others'

,if(WRLD_RGN='Supra','Asia & Others'

,if(WRLD_RGN='Asia','Asia & Others'

,if(WRLD_RGN='OffShore','Asia & Others'

,if(WRLD_RGN='India','Asia & Others'))))))))))))

My Bar Chart as the following expressions:

count({<WRLD_RGN={'Oceania','Supra','Asia','OffShore','India'}>} WRLD_RGN)

count({<WRLD_RGN={'Africa','E.Eur','Europe','MiddleEast'}>} WRLD_RGN)

count({<WRLD_RGN={'Lat.Amer','N.Amer','Caribbean'}>} WRLD_RGN)

count(WRLD_RGN)

and the following dimension which is irrelevant in my mind: LT_RTNG

1 Solution

Accepted Solutions
swuehl
MVP
MVP

I think your list box and bar chart is connected very well, but you set a new selection to WRLD_RGN in your set expression, so the actual selection in your list box is not taken into account.

add a WRLD_RGN * to the assignment to WRLD_RGN just after the equal sign (or use *=), like in

=count({<WRLD_RGN=WRLD_RGN*{'Oceania','Supra','Asia','OffShore','India'}>} WRLD_RGN)

This should do the trick.

Stefan

edit:

you might also consider using a separate table to link your regions to your classification maybe like

LOAD * INLINE [

WRLD_RGN, SALESREGION

Lat.Amer,North America

N.Amer,North America

Caribbean,North America

Africa,EMEA

E.Eur,EMEA

Europe,EMEA

MiddleEast,EMEA

Oceania,'Asia & Others'

Supra,'Asia & Others'

Asia,'Asia & Others'

OffShore,'Asia & Others'

India,'Asia & Others'

];

Then you could use SALESREGION as a listbox as well as a dimension field in your chart.

View solution in original post

2 Replies
swuehl
MVP
MVP

I think your list box and bar chart is connected very well, but you set a new selection to WRLD_RGN in your set expression, so the actual selection in your list box is not taken into account.

add a WRLD_RGN * to the assignment to WRLD_RGN just after the equal sign (or use *=), like in

=count({<WRLD_RGN=WRLD_RGN*{'Oceania','Supra','Asia','OffShore','India'}>} WRLD_RGN)

This should do the trick.

Stefan

edit:

you might also consider using a separate table to link your regions to your classification maybe like

LOAD * INLINE [

WRLD_RGN, SALESREGION

Lat.Amer,North America

N.Amer,North America

Caribbean,North America

Africa,EMEA

E.Eur,EMEA

Europe,EMEA

MiddleEast,EMEA

Oceania,'Asia & Others'

Supra,'Asia & Others'

Asia,'Asia & Others'

OffShore,'Asia & Others'

India,'Asia & Others'

];

Then you could use SALESREGION as a listbox as well as a dimension field in your chart.

Not applicable
Author

Thanks Stefan, that was it!