Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Highlighted
Not applicable

Max Value in different Alternate States

Hi

I am forced to have a screen with 3 bar graphs, each in its own alternate state.

In order to get comparable bar sizes I want to set the static min/max values of the graphs to the current highest number in the 3 graphs.

I tried to create (a rather large) formula with rangemax but I would need to get the max value of the dimensions selected.

Is there an accessible property of the Bar Chart for the max value or the max scale in that chart?

Juerg

6 Replies
Highlighted
MVP
MVP

Re: Max Value in different Alternate States

Juerg,

I would do it like this:

I assume you have a simple bar chart, dimension DIM, expression =sum(VALUE)

[Your setting is probably more complicated, just to simplify my sample]

Create a second chart and an alternate state called AS, assign the second bar chart to the alternate state AS.

Then create two variables, called vMax1 and vMax2:

=max( aggr(sum( VALUE),DIM))

=max({AS} aggr(sum({AS} VALUE),DIM))

and in your bar charts, use an expression for static max axis scale:

=rangemax(vMax1,vMax2)

Hope this helps,

Stefan

Highlighted
Not applicable

Re: Max Value in different Alternate States

Hey Juerg,

Why don't you set all 3 graphs to a forced 0? That way you can compare them easily.

gr.

Frank

Highlighted
Not applicable

Re: Max Value in different Alternate States

Hi Stefan

Thanks for your suggestion. Tried to follow your path but still do not get what I need.

I had to adjust slightly your formula to

=max(Aggr(sum({[AS]}VALUE), DIM))

but DIM seems not to be bound to [AS] and I could not find a way to redo the formula to make it work correctly

Any further hint?

--> Frank - the graphs do not synchronize the scale based on the forced 0 setting.

Juerg

Highlighted
Not applicable

Re: Max Value in different Alternate States

Hi all

I had some other issues that made my results look wrong.

The basic formula

=max(Aggr(sum({[AS]}VALUE), DIM))

worked for me although with some additional conditions

=max(Aggr(sum({[AS]<ID={1,2,3}>}VALUE), DIM, ID))

In order to make the bars align I had also to set the Static Min values for the axes

Juerg

Highlighted
MVP
MVP

Re: Max Value in different Alternate States

Juerg,

why do you had to remove the state AS from the set identifier inside the max() function?

I haven't fully understood your last two actions, so maybe you could look at attached sample and maybe modify it to your needs (or repost a modified sample for better understanding).

Regards,

Stefan

Highlighted
Not applicable

Re: Max Value in different Alternate States

Hi Stefan

From what I tried out it did not matter whether I had the {AS} for the max function or not in my situation. Playing around with your example shows that in your case the {AS} selector is required in both functions in order to work. I assume it's because my different graphs use separate Dimension tables for different hierarchy level selections.

My other additions are due to the special additional requirements where the graph does not show bars for all values in the table but only for a subset of ID's. So it was necessary to limit the sum building to these ID's and in addition to add the ID to the sum grouping.

Thanks again

Juerg