Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

Box plot and alternate state - does it work?

Hello,

I'm trying to create a box plot with two bars, one for the default state and one for an alternate state by they keep stacking ontop of eachother. This works perfect when doing an ordinary bar chart. Doesn't box plot work with alternate state?

// Fredrik

5 Replies
Not applicable

Re: Box plot and alternate state - does it work?

Hi Fredrik

As far as I am aware you are only able to display two boxplots side by side if they are comparing values within a dimension.

To get around this, you can create a "dummy" dimension in the script and then use set analysis to do your magic with the alternate states.

Start by loading an inline table with 2 "dummy" counter values:

Dummy_Table:

LOAD * INLINE [

    Dummy_Field

    1

    2

];

NB don't try and join this to anything, it needs to be freestanding!

Once you have re-loaded your script, set your dummy field as the dimension.

Then in the box plot, use if statements to determine which formulae to use dependant on which "dummy value" is in the dimension:

EG for the Box Plot Top:

=pick([Dummy_Field],fractile(Sales,0.75),fractile({Alternate_State_Name} Sales,0.75)

and for the bottom:

=pick([Dummy_Field],fractile(Sales,0.25),fractile({Alternate_State_Name} Sales,0.25)

This "chooses" which function to use based on the the 1 and 2 in the dummy field.

If you wanted to make it nicer (ie have values labelled in the X axis) you could either give the dummy values dual values or use if statements.

Let me know if this works!

Regards,

Erica

Not applicable

Re: Box plot and alternate state - does it work?

Hi Erica,

Thanks for your reply. I tried what you sugggested both with creating duals in the script and with a calculated dimension but it doesn't work. Any other suggestions?

// Fredrik

Not applicable

Re: Box plot and alternate state - does it work?

Hi Fredrik

Try without the duals keeping it simple with the dummy script, does that work?

Otherwise send me the expression you need to create the top and bottom elements of the box plot and I'll see if I can help

Erica

Not applicable

Re: Box plot and alternate state - does it work?

Hello,

I tried also with just a calculated dimension Valuelist('Group1','Group2') but it didn't work either. I spoke to Qliktech and they said that alternate state and grouped mode for box plot isn't supported. It would be excellent if you know a way around it.

The top expression I need is fractile(Amount, 0.9), Bottom: Fractile(Amount, 0.1) and middle: Median(Amount)

Thanks

Fredrik

Not applicable

Re: Box plot and alternate state - does it work?

Hi Frederick

If you use valuelist then you won't be able to reference those values in the subsequent expressions, whereas if it's a dimension,then you can. Also, if you are using text, the pick() expression won't be as simple.

Say you are using 'Group 1' and 'Group 2' as the values we can use if statements in the top, bottom and middle amounts:

Top: If(dummy_field = 'Group 1', fractile(Amount, 0.9),fractile({alternate state name} Amount, 0.9))

Middle: If(dummy_field = 'Group 1', fractile(Amount, 0.5),fractile({alternate state name} Amount, 0.5))

bottom: If(dummy_field = 'Group 1', fractile(Amount, 0.1),fractile({alternate state name} Amount, 0.1))

I only used pick with numbers as it's a bit simpler, but if statements should work fine.

Erica

Community Browser