Calcite | Level 5

## How to compute percent change from previous day for a measure

Hi all,

in VA 7.3 I'm looking at a table of web session data where each row is indicated by a session date, a unique session ID, and a dummy (1,0) variable called clicks (See also attached screenshot). I would like to create a line chart where for each day the percent of change from the previous day for the number of clicks  (in my case the sum of clicks) is displayed.

I have experimented with the Aggregated Measures feature  in Explorer (i.e., the RelativePeriod Periodic operator), but when I create such an aggregated measure and use the line plot visualization, I get only missing values. So, I'm not sure if it is possible using periodic operators for daily values. The User's Guide documentation lists conditions under which that operator returns missing values:

Note: Periodic operators return a missing value in the following scenarios:

• Data does not exist for the specified time period.
• The date data item for the period calculation does not match the date data item in the visualization or report object. You must use the same date data item or a duplicate data item that is based on the same data item.
• The interval for the operator is smaller than the interval of the date format in the visualization or report object (for example, if your interval is by month, but the date format is Year).
• For operators that use inner and outer intervals, the inner interval is larger than the outer interval.
• The inferred interval is by week of the year or by an interval smaller than a day.
• The inferred interval is by day for any operator that has an offset other than 0.

Is there a workaround solution to use calculated items or aggregated measures to get what I want? Or am I doing something wrong and misinterpret the documentation?

Thanks in advance for any insides or suggestions

Best regards,
sahrens98

BTW, if you need to reproduce the simulated data from the screenshot, you may use this SAS code and then upload the resulting SAS table to LASR:
``````data tmp;
do session_id=1 to 10000;

factor=int(ranuni(2)*700);
session_date=date()-factor;
if ranuni(1)>0.9 then click=1; else click=0;

output;
end;

format session_date date9.;

drop factor;
run;

proc sort data=tmp; by session_date;run;``````

SAS Employee

## Re: How to compute percent change from previous day for a measure

sahrens98:

You are correct. % change from previous day is not possible in VA.

Periodic Operators do NOT work on Daily data EXCEPT for Period To Date function.

The SAS VA Product Managers are aware of this feature request from customers and the hope is to have this supported in a future release.

Sincerely,

Ted Stolarczyk, SAS Customer Loyalty team

Discussion stats