Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 anellibridge
		
			anellibridge
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hello,
I have a table showing Category Code, Sales Date, and Objects:
I want to calculate for each Category Code the quantity of distinct Objects that have the max Sales Date for each Category Code:
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
 justinphamvn
		
			justinphamvn
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi Arianna
Try this: FirstSortedValue(aggr(Count( distinct Objects),[Sales Date] ), -[Sales Date] )
I hope this helps.
Thank you!
Justin
 anellibridge
		
			anellibridge
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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,
