Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
DP_Boy
Contributor II
Contributor II

show also unassociated rows in Aggr()

How to show also the unassociated rows in a dimension  with an Aggr() fuction like below?

=Aggr(ALT(EmploymentEnddate,0)=0, EmployeeFullName,
if(Min(Year)<= Year(EmploymentEnddate) , EmployeeFullName)), EmployeeFullName, EmploymentEnddate)

I think it is something like the formula below but this gives me no dimension results

=Aggr(ALT(EmploymentEnddate,0)=0, Only({($ 1<EmployeeFullName={'*'}>)>}EmployeeFullName),
if(Min(Year)<= Year(EmploymentEnddate) , Only({($ 1<EmployeeFullName={'*'}>)>}EmployeeFullName))), EmployeeFullName, EmploymentEnddate)

Appreciate your help. 

 

Labels (1)
4 Replies
hic
Former Employee
Former Employee

Your expression contains errors:

  • You should use a "1" in your set expression to get all rows, i.e. {1<...>}
  • You use both $ and 1 in "{($ 1<...". Remove the $.
  • It seems to me as if you have too many parameters in the Aggr() call. For example, you use "ALT(EmploymentEnddate,0)=0" as the first parameter of the Aggr(), when this should be the measure of the Aggr().
  • You have unnecessary brackets in your set expression. Use "{1<...>}" instead of "{(1<...>)}"
DP_Boy
Contributor II
Contributor II
Author

Thanks Henric for your reply. 

You are right with point 3.

An if statement was missing in the formula above. 

I changed the expression with your points included. 

=Aggr(if(ALT(EmploymentEnddate,0)=0, Only({1<EmployeeFullName={'*'}>}EmployeeFullName),
if(Min(Year)<= Year(EmploymentEnddate), Only({1<EmployeeFullName={'*'}>}EmployeeFullName))), EmployeeFullName, EmploymentEnddate)

This value shows also no values in the dimension. (See attachment 1)

If I change the '1' in an '-' it gives me results but if I select one value it doesn't show me the unassociated rows. (See attechment 2)

Appreciate your anwser.

hic
Former Employee
Former Employee

Also, you should use double quotes or brackets in your search. Single quotes will not work.

I.e. {"*"} or {[*]} but not {'*'}

 

DP_Boy
Contributor II
Contributor II
Author

Thanks Henric_Cronström! 

The formula works but the 'Only' function doesn't fix the problem to show also not selected values in the dimension. (See attachment 2)

The formula is now:

=Aggr(if(ALT(EmploymentEnddate,0)=0, Only({1<EmployeeFullName={"*"}>}EmployeeFullName),
if(Min(Year)<= Year(EmploymentEnddate), Only({1<EmployeeFullName={"*"}>}EmployeeFullName))), EmployeeFullName, EmploymentEnddate)

Does anyone have a solution for me?