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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
eugeniyaromanov
Contributor III
Contributor III

Min and Max values

Hello!

I've got another question.

I need to count in a text field min and max for a price.

So basically I need to show 0.22 (pink number) as min and 48.21 (red number) as max.

But when I try to count it it always show something else.

All this numbers are not in original data, they all are calculated.

I realize than I need to count it depending on fields: MonthYear, Type and Country, but don't know how.

Here is my table:

             

MonthYearTypeCountry total Litrestotal AmountPrice
=sum(Litres) = sum(Amount) =sum(Amount)/sum(Litres)
oct-2016type1FR1'901'848.00425'740.890.22
dec-2016type1FR1'828'807.00417'415.150.23
nov-2016type1FR1'687'858.00374'598.900.22
oct-2016type2BE882'472.38673'299.210.76
dec-2016type2BE798'774.70634'574.940.79
nov-2016type2BE744'572.30558'997.410.75
dec-2016type2ES636'515.96488'581.450.77
nov-2016type2ES556'924.56400'173.860.72
oct-2016type2ES421'531.36311'164.870.74
oct-2016type2FR321'233.95278'641.320.87
dec-2016type2FR249'704.06226'250.380.91
nov-2016type2FR206'497.34176'489.080.85
dec-2016type1ES2'322.2542'316.9318.22
dec-2016type1BE1'836.0242'930.2123.38
nov-2016type1ES1'801.0037'118.2320.61
oct-2016type1ES1'393.0024'903.1517.88
oct-2016type1BE983.0047'394.9048.21
nov-2016type1BE933.0041'168.73

44.13

Original Data looks like:

     

MonthYearTypeCountryLitresAmount
oct-2016type2Belgium0,050,04
oct-2016type2Belgium0,060,04
oct-2016type2Belgium0,080,06
oct-2016type2Belgium0,090,07
oct-2016type2Belgium0,10,08
oct-2016type2Belgium0,160,13
oct-2016type2Belgium0,290,23
oct-2016type2Belgium1,160,87
oct-2016type2Belgium1,250,97
oct-2016type2Belgium1,71,32
oct-2016type2Belgium1,711,32
oct-2016type2Belgium1,741,35

etc.. there are about 22453 lines in original data.

I'll be glad to answer all questions!

BR

Eugeniya

13 Replies
sunny_talwar

May be this

Min

=FirstSortedValue(Country, Aggr(Sum(Amount)/Sum(Litres), MonthYear, Type, Country))

Max

=FirstSortedValue(Country, -Aggr(Sum(Amount)/Sum(Litres), MonthYear, Type, Country))

or

Min

Concat(DISTINCT Aggr(If(Sum(Amount)/Sum(Litres) = Min(TOTAL Aggr(Sum(Amount)/Sum(Litres), MonthYear, Type, Country)), Country), MonthYear, Type, Country))

Max

Concat(DISTINCT Aggr(If(Sum(Amount)/Sum(Litres) = Max(TOTAL Aggr(Sum(Amount)/Sum(Litres), MonthYear, Type, Country)), Country), MonthYear, Type, Country))

eugeniyaromanov
Contributor III
Contributor III
Author

1st

works as Max


2nd

don't work


3d and 4th work as Max

sunny_talwar

3d and 4th work as Max

3rd and 4th both works as max?

eugeniyaromanov
Contributor III
Contributor III
Author

M... I mush have typed smth wrong first time, now it works well!

Thanks!

3d and 4th work perfect.