Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
pennetzdorfer
Creator III
Creator III

aggr using an 'if-dimension'

Hey,

I have got the following aggr-function which returns the Sales for the best Sales representative:

max(aggr(sum(Sales),SalesRep))

Now I would like to replace the dimension value with an if statement:

max(aggr(sum(Sales),if(Variable=1,SalesRep,Region)))

Obviously that expression isn't valid. Do I miss something?

Regards,

Florian

1 Solution

Accepted Solutions
fosuzuki
Partner - Specialist III
Partner - Specialist III

Check the attached qvw.

Hope this helps you

Fernando

View solution in original post

5 Replies
Anonymous
Not applicable

Hi did u try

f(Variable=1,

max(aggr(sum(Sales),SalesRep)), 

max(aggr(sum(Sales),Region)))

pennetzdorfer
Creator III
Creator III
Author

Replacing the if-Condition with a variable doesn't work either.

Please find the attached qvw.

fosuzuki
Partner - Specialist III
Partner - Specialist III

Check the attached qvw.

Hope this helps you

Fernando

pennetzdorfer
Creator III
Creator III
Author

alfasierra, thanks for your suggestion, I agree.

But: I posted a rather simplified example to demonstrate the basic problem. In my real application I have several possible dimension values (such as SalesRep, Region ...) and some other if conditions. Plus, I'm using similar expressions in a couple of objects -->  thus I would like to keep them as simple as possible.

I'm wondering why the if-condition doesn't work as supposed.

Regards, Florian

pennetzdorfer
Creator III
Creator III
Author

That works!! Thanks Fernando