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

Expression mistake

Hello

I was wondering if anyone can help me,

I got the following expression working fine. I want a formula that adds the values that exceed X. The thing is, when X is a number, it'll work fine, but i need to get a formula in that number, that would be the average of theTotal Sale witht he number of SalesPerson with a Sale.

I currently have that expression in another column, but it wont work using the Column(1) function. I've also tryed to copy the formula for the average (insted of the X) but it wont work either.

sum(Aggr(if(Sum(Aggr((Price_TE), Created_New,SalesPersonName,OrderItem_ID))>=X,

Sum(Aggr((Price_TE), Created_New,SalesPersonName,OrderItem_ID)),

0),Created_New, WeekC,SalesPersonName))

Does anyone got an idea how i can do this?

thanks for the support

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Well, I think your expressions could be simplified, but that would require some more time to look into your data model.

I would assume that you should be able to create similar without the need for so many aggr() functions.

Try something along these lines:

Sum( Aggr( If( Sum(Aggr(Price_TE, Created_New,SalesPersonName,OrderItem_ID))

>=

sum(TOTAL<WeekC,Created_New> Aggr(Price_TE,OrderItem_ID))

/count(TOTAL<WeekC,Created_New> Distinct SalesPersonName),

Sum(Aggr(Price_TE, Created_New,SalesPersonName,OrderItem_ID)),0), Created_New, WeekC,SalesPersonName)

)

View solution in original post

4 Replies
sunny_talwar

Can you share a sample where we can try it out?

Not applicable
Author

There it is.

I need the last expression of the last table (the red one) to use insted of the value 100000 i wrote there, to be the value from Column(7), or the average of each SalesPerson.

KR

swuehl
MVP
MVP

Well, I think your expressions could be simplified, but that would require some more time to look into your data model.

I would assume that you should be able to create similar without the need for so many aggr() functions.

Try something along these lines:

Sum( Aggr( If( Sum(Aggr(Price_TE, Created_New,SalesPersonName,OrderItem_ID))

>=

sum(TOTAL<WeekC,Created_New> Aggr(Price_TE,OrderItem_ID))

/count(TOTAL<WeekC,Created_New> Distinct SalesPersonName),

Sum(Aggr(Price_TE, Created_New,SalesPersonName,OrderItem_ID)),0), Created_New, WeekC,SalesPersonName)

)

Not applicable
Author

awsome, this worked gr8, had to make few adjustment for the totals but it worked!!!

Thanks alot