# Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

New Contributor III

## Calculate salesbonus based on max bonus value

Hi,

I am trying to create an app that calculates salesbonus for our Salespersons. It works in steps so items between 1-10 give 100, between 10-20 200 and so on until 500 is reached. But the problem is that it works backwards, so if you have reached 20 the amount is 200 for every item sold, also items between 1-10 etc. So I need to find a way that finds the max value of bonus amount and applies to all former items sold.

 SalesStaff SalesDate Max(QtySumInsurance) Max(BonusAmt) BBK 10/2/2017 0:00 6 100 BBK 10/3/2017 0:00 11 150 BBK 10/4/2017 0:00 16 150 BBK 10/5/2017 0:00 22 200 BBK 10/6/2017 0:00 30 200 BBK 10/9/2017 0:00 36 250 BBK 10/10/2017 0:00 38 250 BBK 10/11/2017 0:00 42 300 BBK 10/12/2017 0:00 47 300 BBK 10/13/2017 0:00 56 350 BBK 10/14/2017 0:00 55 350 BBK 10/16/2017 0:00 59 350 BBK 10/17/2017 0:00 61 400 BBK 10/18/2017 0:00 65 400 BBK 10/19/2017 0:00 69 400

So in this example 400 is the maximum and I would like to be able to use that as a multiplier for items back in time or for example for 10/2/2017 I would calculate 6*400 = 2400.

Any ideas on how to solve this?

Regards

Birkir

Tags (4)
1 Solution

Accepted Solutions
MVP

## Re: Calculate salesbonus based on max bonus value

May be this

Max(TOTAL <SalesStaff> BonusAmt)

5 Replies
MVP

## Re: Calculate salesbonus based on max bonus value

May be this

Max(TOTAL <SalesStaff> BonusAmt)

Contributor III

## Re: Calculate salesbonus based on max bonus value

Is the Bonus calculated by the amount per sale or by the accumulated amount of a given period?

New Contributor III

## Re: Calculate salesbonus based on max bonus value

Sunny

Thanks for this, it works. I forgot one thing, on the first day of each month the accumulative number or QtySumInsurance should return to 0, I would handle that in the load any idea?

New Contributor III

## Re: Calculate salesbonus based on max bonus value

Hi ,

Marco the bonus works by the number of item sold, so if you sell between 1-10 you get 100 for each,10-20 200 and so on. But each month the accumulative qty should return to 0 , I have not solved that.

MVP

## Re: Calculate salesbonus based on max bonus value

Return to zero or are you looking for Max by each month?