Exploring, predicting and reporting with SAS Visual Analytics and SAS Visual Statistics

before and after sales

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 8
Accepted Solution

before and after sales

I am having a hard time finding a solution to this question, therefore I need your help.

 

I have a table that has a record for each invoice #.  Each record will also have other fields such as cust# sales posted date, sales, etc. etc.  I have joined this table to my customer table that has a date that denotes when this customer became a loyalty customer.  So now my output table, for each record, has a posted date and the loyalty date.  I'm trying to determine the sales for each customer prior to and after the loyalty date.

 

I have tried derived items (maybe i'm not using the correct one) and i've also tried various formats for formulas, such as

If (loyalty date >= posted date), 1 0

 

This lumped every customer as a 1 or a 0, but did not separate them out at the invoice level.  Maybe i need to do something to the dates in the calculated item, i'm not sure. 

 

Any advice?


Accepted Solutions
Solution
‎05-09-2018 07:09 AM
PROC Star
Posts: 402

Re: before and after sales

Posted in reply to Josh_Breault

Maybe you can create two new calculated variables for sales (i call it salesVar here) like:

 

Sales_after:

if loyalty date >= posted date then salesVar else 0

 

Sales before:

if missing(loyalty date) then salesVar else 0

 

//Fredrik

View solution in original post


All Replies
Solution
‎05-09-2018 07:09 AM
PROC Star
Posts: 402

Re: before and after sales

Posted in reply to Josh_Breault

Maybe you can create two new calculated variables for sales (i call it salesVar here) like:

 

Sales_after:

if loyalty date >= posted date then salesVar else 0

 

Sales before:

if missing(loyalty date) then salesVar else 0

 

//Fredrik

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 148 views
  • 1 like
  • 2 in conversation