Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
reivax31
Partner - Creator III
Partner - Creator III

max() function for charts

Dear Community,

I'm tring to use the max() function combinated with count().

max([date import]) : gives me the date

Count(ID): gives me the number of ID

And what I want is to count only the ID when [date import] is max. So I tried different things:

Count(if( [date import]= max([date import]), ID))

Count({<max([date import])>} ID)

... It didn't work...

I'm sure it's possible ! thanks for your help

Best regards

18 Replies
sunny_talwar

Is Activité one of your dimension? It seems that it will only work if it is one of the dimension: https://help.qlik.com/sense/2.0/en-US/online/#../Subsystems/Hub/Content/ChartFunctions/BasicAggregat...

Capture.PNG

reivax31
Partner - Creator III
Partner - Creator III
Author

Yes "Activité" is the first dimension and the values can be (ST59, ST50, ST40, etc...)

reivax31
Partner - Creator III
Partner - Creator III
Author

I added some bracket and the expression is now "OK" but in my charts values are all =0Capture.PNG

sunny_talwar

Can you add another expression to your chart

=Max(TOTAL <Activité> [date import]), ID))

and see what output it shows you?

reivax31
Partner - Creator III
Partner - Creator III
Author

I tried but I didn't manage to get any good result. I also added the .qvf file to my initial message. So it's maybe easier to do some trial...

sunny_talwar

Awesome, checking it now

sunny_talwar

See if this expression helps:

Count(If(Aggr([date import] = Max(TOTAL <[Activité]> [date import]), [Activité], MSN, [date import]), ID))

reivax31
Partner - Creator III
Partner - Creator III
Author

Perfect. I would never have found this on my own. Never had to do something that twisty. Thanks for your help and your time Sunny. I hope I can return the favour one day, but a lot of training needed before!

Have a nice day!

sunny_talwar

Hahaha it took me a while before I figured it myself, but I know people in the community who would have given you the solution in a blink of an eye. I am learning, you are learning, we all learning. So one day, I would be glad to receive your help.

Best,

Sunny