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: 
jduluc12
Creator
Creator

Aggr in dimension does not return multiple values

Hi,

I am using Aggr in dimension like this

aggr( if( sum({<Type={'LA'}>}Amount) > 0, Name ), Address, Rep).

If there is more than one "Name" for the combination of "Address" and "Rep" then it returns NULL.

If there is only one "Name" for the combination of "Address" and "Rep" then it returns that value.


I also tried with NODISTINCT but it did not work.


What am i doing wrong?


Thanks,

Jean

1 Solution

Accepted Solutions
sunny_talwar

May be try this

Aggr(If(Sum({<Type={'LA'}>} Amount) > 0, Name), Name, Address, Rep)

or this

Aggr(If(Sum(TOTAL <Address, Rep> {<Type={'LA'}>} Amount) > 0, Name), Name, Address, Rep)

View solution in original post

6 Replies
sunny_talwar

May be try this

Aggr(If(Sum({<Type={'LA'}>} Amount) > 0, Name), Name, Address, Rep)

or this

Aggr(If(Sum(TOTAL <Address, Rep> {<Type={'LA'}>} Amount) > 0, Name), Name, Address, Rep)

jduluc12
Creator
Creator
Author

I tried the first one and it seems to be working.

Thanks.

So it seems that aggr can not return multiple values so you add name also in the dimensions so each value gets returned becasue then it will be only one value per name,

sunny_talwar

Yup, but keep in mind that now Sum({<Type={'LA'}>} Amount) > 0 is also evaluated at Name (in addition to Address and Rep) level vs. just checking Sum({<Type={'LA'}>} Amount) > 0 against Address and Rep.

jduluc12
Creator
Creator
Author

Yeah, I got that and it works for this one

but

what if i need to include only Address and Rep

is it possible?

sunny_talwar

What do you mean include only Address and Rep? Not sure I understand?

jduluc12
Creator
Creator
Author

I was responding to your comment

"Yup, but keep in mind that now Sum({<Type={'LA'}>} Amount) > 0 is also evaluated at Name (in addition to Address and Rep) level vs. just checking Sum({<Type={'LA'}>} Amount) > 0 against Address and Rep."


Right now the expression is getting evaluated at Name level too.


So I was asking what if i do not want to evaluate the expression at the Name level and just at Address and rep level but still include all names i.e. Aggr() should return multiple values.


Is it even possible?