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

Announcements
Join us at Qlik Connect 2026 in Orlando, April 13–15: Register Here!
cancel
Showing results for 
Search instead for 
Did you mean: 
dwighttrumbower
Creator II
Creator II

How would calculate weekly streaks of sales meeting quota?

Weekly data. Current week

dwighttrumbower_0-1744226442174.png

 

I need to create a streak column showing when sales was >= quota for a week. 

If North also meet the criteria for the previous week then it would show 2 vs 1. The idea is to show how many weeks as possible for a streak. 

If I had four regions, it is possible that the streak column could hold the following.

North   4
South  2
East  0
West  -2

Is this something I can do with set analysis or create a computed column on the load?

 

Thanks

 

 

 

Labels (2)
3 Replies
nevopotokcloudinary

 

Nice use case. I’d probably calculate the streak in the script so the chart stays simple.

Example idea (per sales rep / region):

 

 
StreakData: LOAD SalesRep, Week, Sales, Quota, If(Sales >= Quota, 1, 0) as MetQuota Resident YourSource ORDER BY SalesRep, Week; Final: LOAD *, If(MetQuota = 1, Peek('Streak') + 1, 0) as Streak Resident StreakData ORDER BY SalesRep, Week; DROP TABLE StreakData;
 

This way Streak shows how many consecutive weeks that rep has met quota, resetting to 0 when they miss. Then just use Max(Streak) in your chart.

Chanty4u
MVP
MVP

Try this 

RangeSum(

  Above(

    Aggr(

      If(Sum(SalesAmount) >= Sum(Quota), 1, 0),

      Region, WeekStart

    ),

    0,

    RowNo(

)

  )

)

Nagaraju_KCS
Specialist III
Specialist III

May be try this 

TempTable:
LOAD
   Region,
   Week_ID,
   Sales,
    Quota,
   IF(Sales >= Quota, 1, 0) AS QuotaMetFlag
FROM YourFilePath
ORDER BY Region ASC, Week_ID ASC;    // Order by clause should be in resident load

FinalTable:
LOAD
   *,
   IF(QuotaMetFlag = 1,
   IF(Region = Peek('Region'), Peek('CurrentStreak') + 1, 1),
   IF(Region = Peek('Region'), 0, 0)) AS CurrentStreak
RESIDENT TempTable;

DROP TABLE TempTable;