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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
gautik92
Specialist III
Specialist III

Target Setting

I have a Scenario like i want to set target for each salesman considering the acheivement of last month if the achievement is more than target of last month i want to set that as target for this month and if achievement is less have to add some percentage to set target for current month.

How can i achieve this ?

Labels (1)
12 Replies
sunny_talwar
MVP
MVP

This:

Capture.PNG

Actual:

LOAD SalesmanID,

  Sales,

  Date#(YearMonth, 'YYYYMM') as YearMonth;

LOAD SalesmanID,

    YearMonth,

    Sales

FROM

Target.xlsx

(ooxml, embedded labels, table is Sheet1);

Target:

LOAD SalesmanID,

  Target,

  Date#(YearMonth, 'YYYYMM') as YearMonth;

LOAD SalesmanID,

    YearMonth,

    Target

FROM

Target.xlsx

(ooxml, embedded labels, table is Sheet1);

MaxDate:

LOAD Max(YearMonth) as MaxYearMonth

Resident Actual;

LET vMaxYearMonth = Peek('MaxYearMonth');

DROP Table MaxDate;

TempTable:

LOAD SalesmanID,

  Sum(Sales) as TotalSales

Resident Actual

Where YearMonth = $(vMaxYearMonth)

Group By SalesmanID;

Join(TempTable)

LOAD SalesmanID,

  Target

Resident Target

Where YearMonth = $(vMaxYearMonth);

Concatenate(Target)

LOAD SalesmanID,

  If(TotalSales >= Target, Target, Target * (1.10)) as Target,

  Date(AddMonths($(vMaxYearMonth), 1), 'YYYYMM') as YearMonth

Resident TempTable;

DROP Table TempTable;

gautik92
Specialist III
Specialist III
Author

for salesmanid 1 the target is 40 for month 8 and he has achieved 50 then for month 9 his target should  be 50 right?

gautik92
Specialist III
Specialist III
Author

Thanks sunindia‌ got the answer