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

How to condition a barchart on several variables?

Dear Community

i am creating one (!) barchart sensitive to three variables (buttons on the left side).

DSDD_0-1604663208380.png

Variable v_time allows to choose between time aggregation daily,weekly,monthly (Dimension of barchart) - works fine. Here i use the function =if('$(v_time)' = 'daily',day_dent,if('$(v_time)' = 'weekly',week_dent,month_dent)) to select the dimension.

Variable v_parameter should allow to select the grouping of the bars (here: field kat_pos), field kat_qty, kat_val and kat_tdif define three other choosable categories. - not working

Variable v_abs allows to choose between absolut and percentual values on the y-axis (measure field) - not working

 

My question: How does the functions look like to get this working:

To choose the grouping i tried:

=if('$(v_parameter)' = 'pos',kat_pos,
if('$(v_parameter)' = 'qty',
if('$(v_parameter)' = 'tdif',kat_tdif,
if('$(v_parameter)' = 'val',kat_val)))) with COUNT(ORDER_NO) as measure.

To change between absolute and relative values i tried:

=if('$(v_abs)' = 'abs',count(ORDER_NO),
if('$(v_abs)' = 'rel',count(ORDER_NO)/count(TOTAL < [no idea. I tried several] > ORDER_NO)*100))

The buttons all fail, except for time-dimension with kat_pos, absolute values (the first of all combinations).

I have no idea what to change and where to change.

Thank you very much

2 Replies
GaryGiles
Specialist
Specialist

For Values in your variable input control for v_parameter, choose Dynamic Values and use the following string in quotes:

'kat_pos~pos|kat_qty~qty|kat_val~value|kat_tdif~tdif'

 

The "|" separates the choices and the "~" allows you to change what is display vs what is selected.

 

Then, in your dimension for bars, simply use $(v_parameter)

 

DSDD
Contributor III
Contributor III
Author

Thank you. It worked but it destroys me another important feature, the manual coloring of each categorical dimension.

I define for each categorical field a master dimension with defined colors, like:

DSDD_2-1604677592104.png

But now the qlik default colors are represented, even if i click "user defined" in the color-section of the plot.

 

DSDD_3-1604677668954.png

Having v_parameter as a master-dimension, i saw that there is the option to manually define colors for all fields. It gives me the desired effect, but would prefer another solution.

Is there any chance to get my manual defined colors, maybe with another selection in the menu or a formula to state my own hex-colors?