Skip to main content
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
Showing results for 
Search instead for 
Did you mean: 

Question on Count based on 2 fields

Hi All,

I am having a situation where i am unable to figure out the expression for Count based on 2 fields. I am trying to create a pie chart with Status as dimension and in the expression, i have to calculate the count of Status on a distinct [CD Key] and the max date. I tried to use Aggr(), several combinations of Count and distinct. Can any one help out?

Thanks in advance.

2 Replies

try this

=count({<Status={'A'}, Date={"$(=date(max(Date))"}>} distinct [CD Key])


But this might not work if the max date is different for each Status... if that's true than may be this

Count(DISTINCT Aggr(If(Date = Max(TOTAL <Status> Date), [CD Key]), Status, Date))