Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
curiousfellow
Specialist
Specialist

compare value with max(value) in set analysis

I cannot understand why I don't get a result with this expression.

Is it not possible to compare a fieldvalue with the max of the same field ?

=Count(distinct {$<
dateNUMtot = {
"$(=Aggr(Max(dateNuMtot),employeenum))"}
>}employeenum)

8 Replies
naveen409
Contributor III
Contributor III

 

Create one  Variable for the expression

vMaxdate = max(datefield)

then create set analysis

=Count(distinct {<datefield={$(vMaxdate)}>}employeenum)

 

Thanks,

Naveen

 

lironbaram
Partner - Master III
Partner - Master III

hi 

what do you want to achieve with this expression 

this doesn't works because your function in the set analysis returns 

=Aggr(Max(dateNuMtot),employeenum))

a series of number one for each employee , 

in what visualization you want to use this expression 

curiousfellow
Specialist
Specialist
Author

I have several records for each employee. So I want to find the record with the highest dateNUMtot for each employee.

And use the value of that record as a dimension-value

 I believe that when I first create a variable,  it gets the value of the highest dateNUMtot of all employees

sunny_talwar

Do you have dateNUMtot as a dimension in the chart?
curiousfellow
Specialist
Specialist
Author

Sorr for my late reaction, but dateNumtot is not a dimension.

 

I tried another expression:

in my script I added a field containing the highest date

But count({<enddate = {"$(=highest_enddate)"} >}employee) does not give correct results too.

neither does count({<enddate = {"enddate=highest_enddate"} >}employee) 

It does when I select one employee, but when I do not select an employee there are no results

 

When comparing both fields with an if statement they are counted as equal

 

sunny_talwar

What exactly is your chart dimension?
curiousfellow
Specialist
Specialist
Author

My dimension is another field. In this situation first year of employment.

sunny_talwar

Would you be able to share a sample or sample data with the expected output?