Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Finding MIN and MAX

Hi All,

I have report which looks like -

Product_CodeCustomer_CodeRegionsum(Sales)
AABCEAST1200
ADEFEAST1400
AMNOEAST1600
BABCWEST1800
BDEFWEST2000
BMNOSOUTH2200

and i want the output like -

Product_CodeCustomer_CodeRegionsum(Sales)Min(Sales)Max(Sales)
AABCEAST120012001600
ADEFEAST140012001600
AMNOEAST160012001600
BABCWEST180018002200
BDEFWEST200018002200
BMNOSOUTH220018002200

Here MIN(Sales) and MAX(Sales) are computed based on Product_Code.

E.g. In the above report, for Product_Code = A, the minimum sales is 1200 and maximum sales is 1600. This should be computed by first doing a GROUP BY on Product_Code, Customer_Code, Region. Then we need to calculate MIN and MAX on the output of this Group.

Please help me how to achieve this.

Regards,

Samir.

Labels (1)
6 Replies
perumal_41
Partner - Specialist II
Partner - Specialist II

Hi

Try this expression

min(Total <Product_Code>Sales)

max(Total <Product_Code>Sales)

Not applicable
Author

I cannot use it in load script as I am handling some user inputs and the chart has to change dynamically on selections.

Regards,

Samir

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try this expressions in chart

For Min

=Min(Total <Product_Code> Sales)

For Max

=Max(Total <Product_Code> Sales)

Hope this helps you.

Regards,

Jagan.

Not applicable
Author

Hi,

Thanks for the reply, however I am not getting correct results in my actual report (which is different than the example above). In some places I am getting 0 values.

Regards,

Samir

perumal_41
Partner - Specialist II
Partner - Specialist II

Hi,

Please upload sample application for reference

tanelry
Partner - Creator II
Partner - Creator II

You need to aggregate sum of sales over the report dimensions

before picking the minimum / maximum.

This should work:

Min(total<Product_Code> aggr(sum(Sales),Product_Code,Customer_Code,Region))