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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Comparing before & after the date of change

I am trying to get, by salesperson, how is the sales growth rate comparing before and after the promotion date.

Sample Table 1: Sales Person Master List

Sales IDSales Person NamePromotion_Date
1Alex1/4/2014
2Thomas1/4/2014
3Rachel1/5/2014
4Lily1/6/2014
5Lee1/6/2014

Sample Table 2: Sales

DateMonthSales IDSales_Amount
1/3/2014312
10/3/2014316
1/4/2014415
2/5/20145110
4/6/2014614
1/2/2014226

I would like to achieve something like this:

Where

Before = 3 months average before promotion date

After = 3 months average from promotion date

Sales Person NameBeforeAfterGrowth Rate
Alex86-25%

I have tried following formula for "Before" but it only works only if I bring in Month into the results table:

if(Month >=Month(AddMonths(Promotion_Date,-3)) and Month < Month(Promotion_Date),

SUM( Sales_Amount) )

What would be the correct formula for this?

3 Replies
SunilChauhan
Champion II
Champion II

see the attched file

hope this helps

Sunil Chauhan
chematos
Specialist II
Specialist II

Before:

SUM({<Date={'>=$(=Addmonths(Promotion_Date,-3) <=only(Date)'}>} Sales_Amount)


After:

SUM({<Date={'>=only(Date) <=$(=Addmonths(Promotion_Date,+3)'}>} Sales_Amount)


Growth Rate:

(After*Before)-1


Also, you could transform to numerics all your date fields and add or sustract 90 days to calculate before or after 3 months, instead using Date type fields

maxgro
MVP
MVP

before

sum(if(Date>=AddMonths(Promotion_Date,-3) and Date<Promotion_Date,Sales_Amount))

after

sum(if(Date>Promotion_Date and Date<=AddMonths(Promotion_Date,+3),Sales_Amount))