Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

curiousfellow
Contributor II

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
New Contributor III

Re: compare value with max(value) in set analysis

 

Create one  Variable for the expression

vMaxdate = max(datefield)

then create set analysis

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

 

Thanks,

Naveen

 

Partner
Partner

Re: compare value with max(value) in set analysis

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
Contributor II

Re: compare value with max(value) in set analysis

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

Re: compare value with max(value) in set analysis

Do you have dateNUMtot as a dimension in the chart?
curiousfellow
Contributor II

Re: compare value with max(value) in set analysis

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

 

Re: compare value with max(value) in set analysis

What exactly is your chart dimension?
curiousfellow
Contributor II

Re: compare value with max(value) in set analysis

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

Re: compare value with max(value) in set analysis

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