You are on page 1of 3

7.

3 Solutions 7-75

8. Creating an Advanced Aggregated Measure


a. Open the browser and sign in to SAS Viya.
b. Open the VA2-Practice7.2c report in the Courses/YVA285/Advanced/Practices folder.
1) In the upper left corner, click (Show list of applications) and select Explore and
Visualize. SAS Visual Analytics appears.
2) Click All Reports.
3) Navigate to the Courses/YVA285/Advanced/Practices folder.
4) Double-click the VA2-Practice7.2c report to open it.
c. In the list table, replace Order Date with Customer Country.
1) In the canvas, click the list table to select it.
2) In the right pane, click Roles.
3) For the Columns role, select Order Date  Customer Country.
The list table should resemble the following:

The Cumulative operator works only with date or datetime data items.
d. Create a new advanced aggregated measure (Aggregate Profit) that calculates a running
total for Profit over the countries.
1) In the left pane, click Data.
2) Select New data item  Calculated item.
a) In the Name field, enter Aggregate Profit.
b) In the Result Type field, select Aggregated Measure.
c) On the left side of the window, click Operators.
d) Expand Aggregated (tabular).
e) Double-click AggregateCells to add it to the expression.
f ) For the Aggregation Type operator, verify that _Sum_ is specified.
g) Right-click the number field for the Measure operator and select Replace with 
Profit.
h) For the Direction of Aggregation operator, verify that default is specified.
i) For the Starting Point of Aggregation, select start and 0.

Copyright © 2020, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
7-76 Lesson 7 Creating Advanced Data Items

j) For the Ending Point of Aggregation, verify that current and 0 are specified.
The expression should resemble the following:

k) In the upper right corner of the window, for the Format field, click (Edit).
(1) In the Format window, expand Currency (basic).
(2) Select Dollar.
(3) For the Width field, verify that 12 is specified.
(4) For the Decimals field, verify that 2 is specified.
(5) Click OK.
l) Click OK to create the new periodic aggregated measure.
The Data pane should resemble the following:

e. In the list table, replace Cumulative Profit with Aggregate Profit.


1) In the canvas, click the list table to select it, if necessary.
2) In the right pane, click Roles.
3) For the Columns role, select Cumulative Profit  Aggregate Profit.

Copyright © 2020, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
7.3 Solutions 7-77

The list table should resemble the following:

f. Answer the following question:


What is the total profit for all countries?
Answer: The total profit for all countries is $8,259,406.82.
• Scroll down to the bottom of the list table.

g. Save the report.

Copyright © 2020, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.

You might also like