Qlik Community

Ask a Question

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

April 22, 2PM EST: Learn about GeoOperations in Qlik Sense SaaS READ MORE
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Max aggr expressions based on 2 dimensions

I am trying to display the min and max # of leads (by store) for the selected region.

Dimensions are REGION and Store, the metric is metric is the sum(leads)

The desired end result will show the user for THAT region the MAX Leads by store (for that particular region), and the Min leads by store (also for the particular region) and where the store selection fits on a guage. 

I tried playing aggr() but i couldnt figure it out.  When i make a selection, the max is always just a sum(Leads) and matches the store selection.

9 Replies

I don't completely understand the requirement from what you have provided. Would you be able to provide a sample or some sample data with the expected output to help you better?

Not applicable


Store, Region, Leads

A, Midwest, 4

B, Midwest, 6

C, Midwest, 12

D, West, 15

E, West, 20

F, West, 22

The desired output is when the user selects Store B, there will be a bar gauge graph that has the minimum value shown as 4, and the max shown as 12.


|////////////////                                      |


4              6                                      12

The / represents shading. 

If the user selects Store C, then the gauge should look as such




4                                                    12

The gauge min and max values should then readjust (based on the expression) so when the user decides to look at store E, the min would now be 15, and the max would be 22. 

Not applicable

I should mention that there are multiple campaigns that roll into each Store's Sum(Leads), I overgeneralized the sample data to make it cleaner.

Store, Region, Leads, Campaign

A, Midwest, 2, CmpA

A, Midwest, 2, CmpB

B, Midwest, 2, CmpA

B, Midwest, 4, CmpB

C, Midwest, 10, CmpA

C, Midwest, 10, CmpB


Can you try this:

Min({<Store, Region = p(Region)>} Leads)

Max({<Store, Region = p(Region)>} Leads)


Hi Jason, having Region and Store as dimensions you can get the max per region with:

Max(TOTAL <Region>Aggr(Sum(leads), Region, Store))

For the Min you only have to change 'Max' to 'Min'

To keep these values ignoring selections you can use:

Max({1} TOTAL <Region>Aggr(Sum({1} leads), Region, Store))

But it will make all stores to show on the table when one store is selected, if you want to keep only the selected stores and the values doesn't change you can use:

If(Count(Store)>0, Max({1}TOTAL <Region>Aggr(Sum({1} leads), Region, Store)))

Edit: When I posted this I wasn't able to see you post with the sample and I was thinking in a table, If you want a gauge the option given by Sunny is faster.

Not applicable

neither of those options worked, however, this appeared to work..after 2 hours of trial and error.

Min({1}aggr({$}sum({$<Store = >}Leads),Store))


Where are using this? in a table or somewhere else?

Not applicable

In a gauge extension in QS. 

Not applicable






Bar Graph - ~Dimension = Store~

                  ~Measure = Sum(Sales)~

STEP 3 (Bit Tricky):

Gauge - ~Measure = Sum(Sales)~

            ~[Min] =


  $<Region = p({

    $<Store= {$(=Store)}>



            ~[Max] =


  $<Region = p({

    $<Store= {$(=Store)}>



Note: [Min] & [Max] are in - Appearances > Presentation > Range Limit in Gauge Properties Panel.

STEP 4: Select Store in Bar Graph. See effects in Gauge.

Note: On No Selection Gauge with set its limits with default values, but that too can be handled accordingly.

Happy Qliking!