Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expession Help

I am looking to calculate what the commission would be for each salesperson. The more units they sell the higher percentage they  make on each sale.

For example if you sell < 500,000 total for a month , you make .0035 on each sale. Over 500,000 you make .0050 on each sale.

I tried using Aggr function for the first part, but no luck.

if(Aggr(sum(loan_amt),LoanOfficer)<=500000,(loan_amt * .0035),0)

It only returns the aggr value on1 record not all.

Any help is appreciated.

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

IF(SUM(loan_amt)<500000, SUM(loan_amt)*.0035,

  IF(SUM(loan_amt)>=500000, SUM(loan_amt)*.0050))

EDIT:

If you want the total amount of commission, use below…

  =

SUM(

AGGR(

IF(

SUM(

loan_amt)<500000,

SUM(

loan_amt)*.0035,

IF(

SUM(

loan_amt)>=500000,

SUM(

loan_amt)*.0050)),

LoanOfficer))

View solution in original post

5 Replies
joshabbott
Creator III
Creator III

Hello,

I'm assuming your chart has a dimension of salesperson?  If so, try something like this:

=(sum(loan_amt) * .0035) + ((sum(loan_amt) - 5000) * .0015)

datanibbler
Champion
Champion

Hi Robert,

why so complicated?

I assume that in your base_data table, you have one line for every individual sales_process, yes?

=> So first you'd have to aggregate your table by salesperson to find out how much every one of them sold.

That is in the help_file. The important things about this are that you need a GROUP BY clause and

you have to take care to keep only those fields you want in your aggregation - just think logically:

==>> QlikView will group by every field you have in the GROUP BY clause - so if you keep the item_nr in there, you will get only very small sums - the total of sales of one specific item by one salesperson, which is probably not what you want.

Better keep just the date, salesperson and [sales] field for the aggregation and join the remainder afterwards.

=> So then you know how much any individual salesperson sold and then you can generate an additional field with the commission by using an IF_construct and the tresholds you have.

HTH

Best regards,

DataNibbler

martinpohl
Partner - Master
Partner - Master

for the total, you need to sum the results for each record

sum(aggr(if(sum(loan_amt)<=500000,sum(loan_amt)*.0035,0),LoanOfficer))

its_anandrjs
Champion III
Champion III

Try like

=If( Sum(TOTAL loan_amt) <= 500000, (Sum( loan_amt ) * .0035) , (Sum( loan_amt ) * .0015 ) )

MK_QSL
MVP
MVP

IF(SUM(loan_amt)<500000, SUM(loan_amt)*.0035,

  IF(SUM(loan_amt)>=500000, SUM(loan_amt)*.0050))

EDIT:

If you want the total amount of commission, use below…

  =

SUM(

AGGR(

IF(

SUM(

loan_amt)<500000,

SUM(

loan_amt)*.0035,

IF(

SUM(

loan_amt)>=500000,

SUM(

loan_amt)*.0050)),

LoanOfficer))