# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Contributor III

## Aggr or max ?

Hello guys, I am relatively new to Qlik Sense, and I have been struggling this past few hours with the following problem:

I have a table from Qlik Connectors which gives me sub_name( hour of the day) and value( number of online fans( from my FB page))
I want to get the maximum value, and the corresponding hour to it,
I tried using Aggr(Max(value),sub_name) but it doesn't work

My end result should be
Max online fans are at 11 - 285.

I have thought of the peek function, but I am not sure

Any help will be highly appreciated.

-Angel

1 Solution

Accepted Solutions
Contributor III

## Re: Aggr or max ?

Hi,

Try this,

=FirstSortedValue(DISTINCT sub_name,-Value&sub_name)&'-'&max(Value)

Regards,

17 Replies
Honored Contributor II

## Re: Aggr or max ?

Try like this,

=max(total aggr(sum(value), sub_name))

MVP

## Re: Aggr or max ?

To get the sub_name with max value:

FirstSortedValue(sub_name, -value)

The maximum value:

Max(value)

Contributor III

## Re: Aggr or max ?

this gives me 180 600 ( which is the sum of all days)
It doesn't work...

Contributor III

## Re: Aggr or max ?

the Max(value) gives me the maximum value, but it doesn't give me the sub_name...

and FirstSortedValue(sub_name, - value) returns 2 ( which is not right)

Honored Contributor III

## Re: Aggr or max ?

Hi Angel,

You need to Aggr per Date, like this

Aggr(FirstSortedValue(DISTINCT sub_name,-value),end_date_pacific)

Regards,

Antonio

Contributor III

## Re: Aggr or max ?

Nope, This returns    -

...

-Angel

Contributor III

## Re: Aggr or max ?

Hi,

Try this,

=FirstSortedValue(DISTINCT sub_name,-Value&sub_name)&'-'&max(Value)

Regards,

Honored Contributor III

## Re: Aggr or max ?

Where You want to use expression ?

If in Text Box then add Max( to previous expression.

Contributor III

## Re: Aggr or max ?

Thanks, this is giving me

10 - 334 ( which is what I expected, I am going to check if it is correct)
Thank you Iakshmipathi p !

Regards,l

Ange