Overview
The Sales Management App includes an intelligent recommendation algorithm that provides personalized sales targets to help salespersons improve their performance. This guide explains how the algorithm works and how to use its recommendations effectively.Accessing Recommendations
View Your Ranking
Wait for the leaderboard to load and display all team members ranked by Performance Index.
The recommendation algorithm is only available to salespersons and appears on the leaderboard screen (source:~/workspace/source/app/src/main/java/project/avishkar/salesmanagement/Leaderboard/LeaderBoardSalesperson.java:66).
How the Algorithm Works
The recommendation system uses a multi-step calculation process to determine your optimal sales target.Step 1: Calculate Performance Index
For each salesperson, the system calculates a Performance Index (PI):- Total Profit Generated: Sum of (Items Sold × Profit Per Item) across all products
- Days Since Registration: Time elapsed since the salesperson joined the team
Step 2: Data Collection
The algorithm collects data for all salespersons under the same manager:Calculate Individual Profits
For each salesperson, the algorithm iterates through their inventory to calculate:
Fetch Registration Timestamps
System retrieves signup timestamps from the LeaderBoard database node (source:~/workspace/source/app/src/main/java/project/avishkar/salesmanagement/Leaderboard/LeaderBoardSalesperson.java:193).
Compute Time Differences
Time is calculated in seconds and divided by 86400 (seconds per day). Adding 1 prevents division by zero for new members.
Step 3: Identify Top Performer
The algorithm identifies the highest Performance Index in the team:Step 4: Calculate Recommended Target
For the current salesperson, the algorithm calculates their target profit:- PI_current: Your current Performance Index
- PI_topper: The top performer’s Performance Index
- (PI_topper - PI_current): The gap between you and the top performer
- PI_current + gap: Your PI if you matched the top performer
- × 1.10: Adds 10% growth factor for continuous improvement
Conservative Growth
The algorithm doesn’t expect you to jump directly to the top performer’s level.
Realistic Targets
By closing the gap incrementally, targets remain achievable and motivating.
Continuous Improvement
The 10% growth factor ensures even top performers have stretch goals.
Fair Competition
All calculations use time-normalized data for equitable comparisons.
Example Calculation
Let’s walk through a real-world example:Scenario Setup
Your Performance:- Total Profit Generated: $5,000
- Days Since Registration: 50 days
- Your PI: 100 per day
- Total Profit Generated: $8,000
- Days Since Registration: 40 days
- Their PI: 200 per day
Target Calculation
Interpreting Your Target
With a target of $220/day:- You need to increase daily performance by 120% (220)
- This closes the gap with the top performer and adds 10% growth
- If you achieve this consistently, you’ll become the new top performer
- The algorithm will then give you a new target based on your improved PI
Implementation Details
The algorithm is implemented in the LeaderBoardSalesperson class (source:~/workspace/source/app/src/main/java/project/avishkar/salesmanagement/Leaderboard/LeaderBoardSalesperson.java:66-135).Key Code Flow
Access Performance Index Array
The performanceIndex ArrayList contains PI values for all team members in the same order as the leaderboard.
Benefits of the Algorithm
Personalized Goals
Each salesperson receives a target based on their specific performance level and the team context.
Motivation Through Competition
Seeing the gap to the top performer motivates improvement while keeping goals realistic.
Fair Comparisons
Time normalization ensures new members aren’t disadvantaged against veterans.
Continuous Improvement
The 10% growth factor ensures that achieving your target pushes you to new heights.
Team Benchmarking
Targets are based on real team performance, not arbitrary corporate goals.
Dynamic Updates
As team performance changes, so do the recommendations, keeping them relevant.
Using Recommendations Effectively
For Salespersons
Check Your Target Regularly
Review your recommended target at least weekly to stay focused on improvement.
Break Down the Goal
If your target is $220/day:
- Calculate how many units you need to sell
- Identify high-profit items to prioritize
- Plan your daily sales activities
Track Progress
Use the Statistics view to monitor your daily profit and compare it against your target.
For Managers
While managers don’t see individual recommendations, understanding the algorithm helps you:Coach Effectively
Explain how the targets work to help salespersons understand their goals.
Set Inventory Strategy
Stock higher-profit items to help salespersons reach their targets.
Identify Struggling Members
If someone consistently misses their target, provide additional support.
Celebrate Top Performers
Recognize that the top performer’s success influences the entire team’s targets.
Algorithm Limitations
While powerful, the algorithm has some considerations to keep in mind.
Edge Cases
- New Team Members: Salespersons registered for only 1-2 days may see volatile targets as their PI stabilizes.
- Small Teams: In teams with only 2-3 salespersons, one strong performer can create very high targets for others.
- Product Mix Changes: If a manager adds high-profit items, historical PIs may not reflect new opportunities.
- Seasonal Variations: The algorithm doesn’t account for seasonal sales fluctuations.
Best Practices to Overcome Limitations
Give Time to Stabilize
Don’t stress over targets in your first week. Focus on learning products and building a baseline.
Communicate with Your Manager
If targets seem unrealistic, discuss with your manager. They can provide context about team dynamics.
Use as a Guide, Not a Rule
The target is a recommendation, not a requirement. Use it to motivate improvement at your own pace.
Future Enhancements
Potential improvements to the algorithm could include:- Seasonal Adjustments: Factor in historical seasonal trends
- Product Weighting: Consider difficulty of selling different products
- Confidence Intervals: Provide a target range instead of a single number
- Time-Based Targets: Separate daily, weekly, and monthly recommendations
- Custom Growth Factors: Managers could adjust the 10% growth rate per team member