Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
anellibridge
Partner - Contributor II
Partner - Contributor II

Count Objects for Max Date in Set Analysis

Hello,

I have a table showing Category Code, Sales Date, and Objects:

TESTA.JPG


I want to calculate for each Category Code the quantity of distinct Objects that have the max Sales Date for each Category Code:
TESTB.JPG

In this example for the Category Code=1, I want that #Objects=2 because there are 2 distinct Objects that have the Sales Date 18/12/2017.

I'm using the Version November 2017 of Qlik Sense.

Any suggestion?

thx a lot,

Arianna

Labels (1)
11 Replies
justinphamvn
Creator II
Creator II

Hi Arianna

Try this: FirstSortedValue(aggr(Count( distinct Objects),[Sales Date] ), -[Sales Date] )

I hope this helps.

Thank you!

Justin

anellibridge
Partner - Contributor II
Partner - Contributor II
Author

Hi Hector,

thank u a lot for your reply, but it doesn't function that formula.

After a lot of test I found the solution!

Count( Distinct If(Aggr(NODISTINCT Max( TOTAL <[Category Code]> [Sales Date]),[Category Code],[Object]) = [Sales Date], [Object]))


Thanks a lot to everyone,