Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variable value for Max option in Gauge chart

Hi All,

We have created a Gauge chart which shows the data of the compnay correclty. We are also able to mark the segment properly.

However, we get stuck, when we try to give variable (changing) values to MAX option in gauge chart.

Our requirement is to make the value of MAX change when the user click on a specific product. As the target for each product will be different and we want to make the max value change per very product in a single gauge chart.

We used the "if" condition but it failed.

Need your assistance.

Regards,

Hitesh

1 Solution

Accepted Solutions
stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Hitesh,

Where are the values coming from for the Max of each product?  Are they hard coded or derived from the data?

If they are hard coded something like this will work:

=if(Only(Product) = 'Ham', 2000, if(Only(Product) = 'Cheese', 3000, 2500))

You can nest the if statement as many times as you need.  The final number is what is used if more than one product is selected or possible.

If the Max is derived from the data then you could us an aggregation to get there:

=Max(ProductMax)

or

=Avg(ProductMax)

If the gauge only makes sense when a single Product is selected then you can use the Calculation Condition or the Show Condition to hide the object or show an error message.

Generally, gauges are more hard to comprehend quickly if the max bound is moving about - but sometimes it is a requirement.

Hope that helps,

Steve

http://www.quickintelligence.co.uk/

View solution in original post

8 Replies
Not applicable
Author

Please attach sample file..

Sokkorn
Master
Master

Hi Hitesh,

Let use this sample expression for your variable:

=If(IsNull(GetFieldSelections(ProductField)),Sum(Amount),Max(Value))

Regards,

Sokkorn

Not applicable
Author

Hi Fellows,

Please find the sample file here.

Regards,

Hitesh

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Hitesh,

Where are the values coming from for the Max of each product?  Are they hard coded or derived from the data?

If they are hard coded something like this will work:

=if(Only(Product) = 'Ham', 2000, if(Only(Product) = 'Cheese', 3000, 2500))

You can nest the if statement as many times as you need.  The final number is what is used if more than one product is selected or possible.

If the Max is derived from the data then you could us an aggregation to get there:

=Max(ProductMax)

or

=Avg(ProductMax)

If the gauge only makes sense when a single Product is selected then you can use the Calculation Condition or the Show Condition to hide the object or show an error message.

Generally, gauges are more hard to comprehend quickly if the max bound is moving about - but sometimes it is a requirement.

Hope that helps,

Steve

http://www.quickintelligence.co.uk/

Not applicable
Author

Hi Steve,

BULLS EYE

The if function worked in our max expression.

Thanks a lot guys for your help.

Not applicable
Author

Hi Guys,

We have found solutions as suggested by Steve, we are using If(Only .. condition.

However, now when I view the entire company data in the gauge chart, it is throwing error of Bad min max value.

The If funciton is working fine when I select individual Product category, but when I make a complete selection og Product category or when I do not select any values in the Product category, we are getting the error of "Bad min max value in Gauge"

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi there,

Do you have the final number in the IF statement, stating which value to use if there are multiple Product Categories selected?

=if(Only(Product) = 'Ham', 2000, if(Only(Product) = 'Cheese', 3000, 2500))

Steve

Not applicable
Author

Yes Steve, got the issue resolved. Thanks for yout kind help.

Regards,

Hitesh