SlideShare a Scribd company logo
5
Most read
10
Most read
12
Most read
Dmitry Anoshin
HOW TO USE CALCULATION
CONTEXT IN SAP BUSINESS
OBJECTS
2 9/25/2013 Footer
By default, when objects are placed in a block, the projected values of the measures are aggregated to the
level of the dimensions displayed in the block.
If you create a table showing Year and Sales revenue (1), the measures will be aggregated to the Year
level, as shown in the first table.
What is Dynamic Calculation in BO
If you added State to the beginning of the table
then the Sales revenue would be aggregated
by year for each state, as shown in the second
table (2).
When you remove a dimension from the table (Year, in
this case), as in the third table (3) in the diagram, Web
Intelligence automatically recalculates the sales revenue
data according to the new context (State, in this case).
You can see in this example that sales revenue is
calculated at the row level. In Web Intelligence, this row
level calculation is the default calculation context for any
measure object or variable placed in a column.
These examples demonstrate the first way of controlling a calculation, where the
level of aggregation is affected by the environment of the report:
The projected values of a measure are aggregated to the level of the
dimensions displayed in the block.
3 9/25/2013 Footer
Projection function
When dimensions are removed from or added to a block the context changes and the measure amounts
also change. This is controlled by the projection function set on each measure by the universe designer.
4 9/25/2013 Footer
What is Input and Output context*
Input and output contexts must be added to a calculation if you want the context of the calculation to be something other
than the default context.
• Input context consists of any dimension objects that need to be included directly IN the calculation itself.
• Output context consists of one or more dimension objects that determine where the calculation is placed in the report, or in
other words, the level where the calculation is to be turned OUT in the report.
*Certain functions (like RunningSum() for example) also have a “reset” context.
5 9/25/2013 Footer
There is a simple (but powerful) set of context operators that we can choose from.
• In is used to specify exactly which dimensions to include in a context. Other dimensions in the block
are ignored. Adding / removing elements from the block does not impact this calculation unless a
removed dimension was specified in the context. In that case a #MULTIVALUE error is displayed.
• ForEach is used to include a dimension in a context. The calculation context is still affected by other
values in the block.
• ForAll is used to exclude a dimension from a context. Other dimensions of the block will still be
considered. Adding or removing values from a block might change the value, but it will always ignore
the ForAll items.
The operators listed above all require one or more dimensions as part of their syntax.
However, calculation context can be specified by more than a set of dimension values. There are a
series of report structure keywords that can be used as well.
• In Report sets the context at the report or “grand total” level. Any formula with these keywords for
the context will return an overall total. Note that the total may still be affected by report filters.
• In Block sets the context for each block. If there is only one block on a report then “In Block” and
“In Report” are going to be the same. But when a block is broken up into sections, then this context
will generate a total for each section value.
• In Body is the standard default context for each row of data.
There are couple practice examples on the next slides, which help you to understand it better
Context Operators
6 9/25/2013 Footer
The following example demonstrates how to extend the syntax of a
formula in order to redefine the output context that will be used to
calculate the measure.
To redefine the output context using extended syntax
1. Create a new Web Intelligence document using the eFashion
universe.
2. In the Java Report Panel, build a query by dragging or double-
clicking the State, Year and Sales revenue objects to move them
into the Result Objects pane.
3. Click Run Query.
4.In Edit Report view, select the State column to highlight it.
5. Click the Insert/Remove Break button on the Reporting toolbar
to break the table into separate blocks.
The Sales revenue measure is currently calculated to show each
state's total sales revenue per year. You can easily see each state's
best year amount as you view the rows in the block.
6. Place a sum and a descending sort on Sales revenue.
Ex.1 To redefine the output context
7 9/25/2013 Footer
7. Create a new table in this report by dragging
and dropping the State and Sales revenue
objects just to the right of this block.
(To select more than one object at a time, click
the first object, hold down the Ctrl key and click
another object. Continue holding down the Ctrl
key and drag both objects at the same time to a
position next to the existing block.)
In this new table, you can see each state's overall
sales revenue, without either the revenue per year
or the state's best year amount. The sales revenue
data has been aggregated to the state level.
8. Create a new variable called State's best year
total. Use the following formula in the variable
definition:
=max([Sales revenue])
Ex.1 To redefine the output context (cont)
8 9/25/2013 Footer
9. Drag and drop the new variable so that the
data is projected in a new column to the right
of the Sales revenue, in the second block.
If you compare the state's best year revenue
shown in the first block with the data calculated
by the variable you just created, you can see
that the default behavior of the calculation, at
the row level, is obviously not the correct
context.
By default, Web Intelligence does not know
that the Year object needs to be included in
context of the calculation - it simply using
State as the input context in order to calculate
the values, and the result is the exact same
calculation that the Sales revenue object
projects.
Now you are going to extend the syntax in
order to specify the correct Input and output
context so that Web Intelligence knows which
context to use to calculate the data correctly.
Ex.1 To redefine the output context (cont)
9 9/25/2013 Footer
10. Modify the variable definition to specify the
Input and output context, using this formula:
=max([Sales revenue] In([Year];
[State])) In ([State ])
Web Intelligence now calculates the data
correctly, because it calculates the maximum
amount of Sales revenue for each State any one
Year.
Ex.1 To redefine the output context (end)
10 9/25/2013 Footer
1. Create a new Web Intelligence document using
the eFashion universe.
2. In the Java Report view, add the
Year, Quarter, State and Sales revenue
objects to the query.
3. Click Run Query.
4. In Edit Report view, remove the Quarter and
the State object from the table.
5. Hold down the Ctrl key and drag the table to
the right to make a duplicate copy.
6. In the copied table, drag the Quarter object
and insert it in a column between the Year and
Sales revenue columns.
7. Apply a break on the Year column.
8. Click the Sales revenue column to highlight it.
9. Click the drop-down arrow next to the Insert
Sum button on the Report toolbar and select
Max.
10. Create a Max Quarterly Revenue variable
using this formula:
=max([Sales revenue] In([Year];
[Quarter])) In ([Year])
11. Drag the new variable to the right of the Sales
revenue column in the original table.
Ex.2 Using the In context operator
11 9/25/2013 Footer
1. In the new report, press the Ctrl key and drag the
Year and Sales revenue objects to create a new
vertical table.
2. Create a Sales revenue By Year for California
variable with the following Input context:
=[Sales revenue] Where
([State]="California")
This context uses the Where operator to isolate
California state in the calculation.
3. Replace the Sales revenue object in the table with
the new variable.
Ex.3 To use the In and Where context operators
12 9/25/2013 Footer
5. Create the Sales revenue for all States calculation by dragging and dropping the Sales revenue
object from the Data tab and dropping it outside the table anywhere in the report space.
6. Insert a free-standing cell to the left of this calculation and enter text that identifies the calculation.
7. Create the Highest Sale Revenue for any one State variable using this syntax:
=Max([Sales revenue] In ([State]))
This context uses the In operator to specify Input context. This assures that the calculation only
addresses the State values when locating a maximum amount.
There is no output context defined, so the calculation uses the default output context of the entire
report, because it was placed at the report level rather than in a table.
8. Drag the new variable in the report space and insert a free-standing cell with text that identifies the
calculation.
9. Create the Highest Annual Revenue for California variable using the following syntax:
=Max([Sales revenue] In([State];[Year]) Where([State]="California"))
This variable definition uses both the In and Where operators to achieve the correct calculation. Both
operators were used in defining the Input context.
- The In operator forces the =Max function to look in the State values first and then the Year values
within each State in order to locate the maximum value.
- The Where operator assures that the =Max calculation is only valid where the State is California.
Ex.3 To use the In and Where context
operators (cont)
13 9/25/2013 Footer
10. Create the Sales revenue for California for 2003
variable using this syntax:
=[Sales revenue] Where([State]="California' And
[Year] =2003")
Like the Sales revenue By Year for California object, this
calculation uses the Where operator in the Input context
to ensure that the calculation is valid for only those values
denoted by the Where operators.
It is not necessary to list the components of the calculation
in order of granularity when using the Where operator. You
must list the components when using the In operator.
11. Insert this variable in the report and insert another
free-standing cell with text to identify the calculation.
Ex.3 To use the In and Where context
operators (end)
14 9/25/2013 Footer
1. In the new report, press the Ctrl key and drag the
Year and Sales revenue objects to create a new
vertical table.
2. Create a Max Quarterly Revenue variable with
the following input context:
=Max([Sales revenue]ForEach([Quarter])) In
([Year])
3. Insert the new variable in the table.
The Year dimension is the default input context in the
block. By using the ForEach operator, you add the
Quarter dimension to the context, giving an input
context of ([Year];[Quarter]).
Ex.4 To use the ForEach context operator
15 9/25/2013 Footer
1. In the new report, press the Ctrl key and drag
the Year, Quarter and Sales revenue objects to
create a new vertical table.
2. Click the Sales revenue column and apply a
sum. The standard sum function inserts a footer in
the table and displays the total revenue for all
quarters in the three years, using the default
calculation context.
You want to display the total revenue for each
year. But to total revenues by year the the input
context needs to be (Year); by default, it is
(Year; Quarter). Therefore, you need to remove
Quarter from the input context by specifying
ForAll ([Quarter]) in the formula, which looks
like this:
=Sum([Sales revenue]) ForAll ([Quarter])
3. Create a Yearly Total variable with the following
input context:
=Sum([Sales revenue]) ForAll ([Quarter])
4. Insert the new variable in the table.
Ex.5 To use the ForAll context operator

More Related Content

PPT
Logical functions in excel
PDF
VB PPT by ADI PART3.pdf
PPTX
MySql Triggers Tutorial - The Webs Academy
PPTX
Normal forms
DOC
Oracle report from ppt
PPTX
Calculated Fields in Tableau
PPTX
Conditional formatting - Excel
PPT
Pivot table presentation
Logical functions in excel
VB PPT by ADI PART3.pdf
MySql Triggers Tutorial - The Webs Academy
Normal forms
Oracle report from ppt
Calculated Fields in Tableau
Conditional formatting - Excel
Pivot table presentation

What's hot (20)

PDF
Using the IF Function in Excel
PPTX
MS Excel Pivot Table Reports & Charts
PPTX
Excel Pivot Tables April 2016.pptx
PPTX
introdution to SQL and SQL functions
PDF
Excel Crash Course: Pivot Tables
PDF
Skillshare - Creating Excel Dashboards
PPTX
Dbms normalization
PPTX
Pivot Tables and Beyond Data Analysis in Excel 2013 - Course Technology Compu...
PDF
Visual Basic IDE Intro.pdf
PPTX
Tableau groups vs sets
PPSX
Conditional formatting in excel v2
PPTX
A Quick Guide to Microsoft Forms
PDF
Oracle Form material
PPTX
MS Excel Training(Basic)
PPT
Ms excel basic about Data, graph and pivot table
PDF
Tableau Tutorial Complete by Rohit Dubey
PPTX
Excel for beginner
PPTX
Pivot Table | Statistics
PDF
Excel Shortcuts & Formulas
PPT
Sql database object
Using the IF Function in Excel
MS Excel Pivot Table Reports & Charts
Excel Pivot Tables April 2016.pptx
introdution to SQL and SQL functions
Excel Crash Course: Pivot Tables
Skillshare - Creating Excel Dashboards
Dbms normalization
Pivot Tables and Beyond Data Analysis in Excel 2013 - Course Technology Compu...
Visual Basic IDE Intro.pdf
Tableau groups vs sets
Conditional formatting in excel v2
A Quick Guide to Microsoft Forms
Oracle Form material
MS Excel Training(Basic)
Ms excel basic about Data, graph and pivot table
Tableau Tutorial Complete by Rohit Dubey
Excel for beginner
Pivot Table | Statistics
Excel Shortcuts & Formulas
Sql database object
Ad

Viewers also liked (7)

DOCX
Calculation contexts in web i
PDF
Reporting Tips
PPT
BI Pre-Sale
PDF
Adaptive processing servers for BO
PDF
How to use result from another query in webi hack bo
PDF
Business Objects....is it LOV?
PDF
SAP BI BO Commentary solution
Calculation contexts in web i
Reporting Tips
BI Pre-Sale
Adaptive processing servers for BO
How to use result from another query in webi hack bo
Business Objects....is it LOV?
SAP BI BO Commentary solution
Ad

Similar to Calculation contex in sap business objects (20)

PPTX
Libre Office Calc Lesson 5: Working with Data
DOCX
Microsoft Excel 20072010 What-If Analysis © Martin Green
PPTX
Calculated Columns and Measures in Power BI.pptx
PDF
Excel creating pivot table
PDF
Print18
DOC
How to design a report with fine report reporting tool
PDF
muthu.shree
PDF
ODT
Open Office Calc : Lesson 07
DOCX
1 Mashing Up Data with PowerPivot When Filter, .docx
DOCX
By Analyzing and Utilizing Jean Watson theory of caring, creat
DOCX
(Ali)Excel Worksheet.xlsxSheet1Excel Homework 2 Directions.docx
PDF
Introduction to Eikon Excel
PPTX
CREATING A DATASET FROM EXCEL IN POWER BI REPORT BUILDER
PDF
Create a PivotTable to analyze worksheet data.pdf
PPTX
Lesson 18 Creating Pivot Tables
DOCX
Scoring documentation
PPTX
Empowerment Technologies.pptx explore the world of technologies
DOCX
computer applications in business unit 3
DOCX
Directions Flexible Budget Performance Report Project  You a.docx
Libre Office Calc Lesson 5: Working with Data
Microsoft Excel 20072010 What-If Analysis © Martin Green
Calculated Columns and Measures in Power BI.pptx
Excel creating pivot table
Print18
How to design a report with fine report reporting tool
muthu.shree
Open Office Calc : Lesson 07
1 Mashing Up Data with PowerPivot When Filter, .docx
By Analyzing and Utilizing Jean Watson theory of caring, creat
(Ali)Excel Worksheet.xlsxSheet1Excel Homework 2 Directions.docx
Introduction to Eikon Excel
CREATING A DATASET FROM EXCEL IN POWER BI REPORT BUILDER
Create a PivotTable to analyze worksheet data.pdf
Lesson 18 Creating Pivot Tables
Scoring documentation
Empowerment Technologies.pptx explore the world of technologies
computer applications in business unit 3
Directions Flexible Budget Performance Report Project  You a.docx

More from Dmitry Anoshin (20)

PPTX
Building Modern Data Platform with Microsoft Azure
PPTX
Building Modern Data Platform with AWS
PPTX
Cloud Analytics Use Cases and Architecture, Math Marketing Conference, Russia...
PPTX
Victoria Tableau User Group - Getting started with Tableau
PPTX
Hey, what is about data?
PPTX
Enterprise Data World 2018 - Building Cloud Self-Service Analytical Solution
PDF
AWS User Group: Building Cloud Analytics Solution with AWS
PPTX
Tableau API
PPTX
My experience of writing technical books
PDF
Business objects activities web intelligence
PPTX
Splunk 6.2 new features
PPTX
Business Analytics Paradigm Change
PPTX
SAP BO and Teradata best practices
PPTX
Exploring Splunk
PPTX
Splunk Digital Intelligence
PDF
Role of Tableau on the Data Discovery Market
PPTX
SAP Lumira - Building visualizations
PPTX
SAP Lumira - Acquiring data
PPTX
SAP Lumira - Enriching data
PDF
Microstrategy for Retailer Company
Building Modern Data Platform with Microsoft Azure
Building Modern Data Platform with AWS
Cloud Analytics Use Cases and Architecture, Math Marketing Conference, Russia...
Victoria Tableau User Group - Getting started with Tableau
Hey, what is about data?
Enterprise Data World 2018 - Building Cloud Self-Service Analytical Solution
AWS User Group: Building Cloud Analytics Solution with AWS
Tableau API
My experience of writing technical books
Business objects activities web intelligence
Splunk 6.2 new features
Business Analytics Paradigm Change
SAP BO and Teradata best practices
Exploring Splunk
Splunk Digital Intelligence
Role of Tableau on the Data Discovery Market
SAP Lumira - Building visualizations
SAP Lumira - Acquiring data
SAP Lumira - Enriching data
Microstrategy for Retailer Company

Recently uploaded (20)

PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
cuic standard and advanced reporting.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Electronic commerce courselecture one. Pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Digital-Transformation-Roadmap-for-Companies.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Understanding_Digital_Forensics_Presentation.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Network Security Unit 5.pdf for BCA BBA.
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
NewMind AI Weekly Chronicles - August'25 Week I
cuic standard and advanced reporting.pdf
Encapsulation_ Review paper, used for researhc scholars
“AI and Expert System Decision Support & Business Intelligence Systems”
The AUB Centre for AI in Media Proposal.docx
Electronic commerce courselecture one. Pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Dropbox Q2 2025 Financial Results & Investor Presentation

Calculation contex in sap business objects

  • 1. Dmitry Anoshin HOW TO USE CALCULATION CONTEXT IN SAP BUSINESS OBJECTS
  • 2. 2 9/25/2013 Footer By default, when objects are placed in a block, the projected values of the measures are aggregated to the level of the dimensions displayed in the block. If you create a table showing Year and Sales revenue (1), the measures will be aggregated to the Year level, as shown in the first table. What is Dynamic Calculation in BO If you added State to the beginning of the table then the Sales revenue would be aggregated by year for each state, as shown in the second table (2). When you remove a dimension from the table (Year, in this case), as in the third table (3) in the diagram, Web Intelligence automatically recalculates the sales revenue data according to the new context (State, in this case). You can see in this example that sales revenue is calculated at the row level. In Web Intelligence, this row level calculation is the default calculation context for any measure object or variable placed in a column. These examples demonstrate the first way of controlling a calculation, where the level of aggregation is affected by the environment of the report: The projected values of a measure are aggregated to the level of the dimensions displayed in the block.
  • 3. 3 9/25/2013 Footer Projection function When dimensions are removed from or added to a block the context changes and the measure amounts also change. This is controlled by the projection function set on each measure by the universe designer.
  • 4. 4 9/25/2013 Footer What is Input and Output context* Input and output contexts must be added to a calculation if you want the context of the calculation to be something other than the default context. • Input context consists of any dimension objects that need to be included directly IN the calculation itself. • Output context consists of one or more dimension objects that determine where the calculation is placed in the report, or in other words, the level where the calculation is to be turned OUT in the report. *Certain functions (like RunningSum() for example) also have a “reset” context.
  • 5. 5 9/25/2013 Footer There is a simple (but powerful) set of context operators that we can choose from. • In is used to specify exactly which dimensions to include in a context. Other dimensions in the block are ignored. Adding / removing elements from the block does not impact this calculation unless a removed dimension was specified in the context. In that case a #MULTIVALUE error is displayed. • ForEach is used to include a dimension in a context. The calculation context is still affected by other values in the block. • ForAll is used to exclude a dimension from a context. Other dimensions of the block will still be considered. Adding or removing values from a block might change the value, but it will always ignore the ForAll items. The operators listed above all require one or more dimensions as part of their syntax. However, calculation context can be specified by more than a set of dimension values. There are a series of report structure keywords that can be used as well. • In Report sets the context at the report or “grand total” level. Any formula with these keywords for the context will return an overall total. Note that the total may still be affected by report filters. • In Block sets the context for each block. If there is only one block on a report then “In Block” and “In Report” are going to be the same. But when a block is broken up into sections, then this context will generate a total for each section value. • In Body is the standard default context for each row of data. There are couple practice examples on the next slides, which help you to understand it better Context Operators
  • 6. 6 9/25/2013 Footer The following example demonstrates how to extend the syntax of a formula in order to redefine the output context that will be used to calculate the measure. To redefine the output context using extended syntax 1. Create a new Web Intelligence document using the eFashion universe. 2. In the Java Report Panel, build a query by dragging or double- clicking the State, Year and Sales revenue objects to move them into the Result Objects pane. 3. Click Run Query. 4.In Edit Report view, select the State column to highlight it. 5. Click the Insert/Remove Break button on the Reporting toolbar to break the table into separate blocks. The Sales revenue measure is currently calculated to show each state's total sales revenue per year. You can easily see each state's best year amount as you view the rows in the block. 6. Place a sum and a descending sort on Sales revenue. Ex.1 To redefine the output context
  • 7. 7 9/25/2013 Footer 7. Create a new table in this report by dragging and dropping the State and Sales revenue objects just to the right of this block. (To select more than one object at a time, click the first object, hold down the Ctrl key and click another object. Continue holding down the Ctrl key and drag both objects at the same time to a position next to the existing block.) In this new table, you can see each state's overall sales revenue, without either the revenue per year or the state's best year amount. The sales revenue data has been aggregated to the state level. 8. Create a new variable called State's best year total. Use the following formula in the variable definition: =max([Sales revenue]) Ex.1 To redefine the output context (cont)
  • 8. 8 9/25/2013 Footer 9. Drag and drop the new variable so that the data is projected in a new column to the right of the Sales revenue, in the second block. If you compare the state's best year revenue shown in the first block with the data calculated by the variable you just created, you can see that the default behavior of the calculation, at the row level, is obviously not the correct context. By default, Web Intelligence does not know that the Year object needs to be included in context of the calculation - it simply using State as the input context in order to calculate the values, and the result is the exact same calculation that the Sales revenue object projects. Now you are going to extend the syntax in order to specify the correct Input and output context so that Web Intelligence knows which context to use to calculate the data correctly. Ex.1 To redefine the output context (cont)
  • 9. 9 9/25/2013 Footer 10. Modify the variable definition to specify the Input and output context, using this formula: =max([Sales revenue] In([Year]; [State])) In ([State ]) Web Intelligence now calculates the data correctly, because it calculates the maximum amount of Sales revenue for each State any one Year. Ex.1 To redefine the output context (end)
  • 10. 10 9/25/2013 Footer 1. Create a new Web Intelligence document using the eFashion universe. 2. In the Java Report view, add the Year, Quarter, State and Sales revenue objects to the query. 3. Click Run Query. 4. In Edit Report view, remove the Quarter and the State object from the table. 5. Hold down the Ctrl key and drag the table to the right to make a duplicate copy. 6. In the copied table, drag the Quarter object and insert it in a column between the Year and Sales revenue columns. 7. Apply a break on the Year column. 8. Click the Sales revenue column to highlight it. 9. Click the drop-down arrow next to the Insert Sum button on the Report toolbar and select Max. 10. Create a Max Quarterly Revenue variable using this formula: =max([Sales revenue] In([Year]; [Quarter])) In ([Year]) 11. Drag the new variable to the right of the Sales revenue column in the original table. Ex.2 Using the In context operator
  • 11. 11 9/25/2013 Footer 1. In the new report, press the Ctrl key and drag the Year and Sales revenue objects to create a new vertical table. 2. Create a Sales revenue By Year for California variable with the following Input context: =[Sales revenue] Where ([State]="California") This context uses the Where operator to isolate California state in the calculation. 3. Replace the Sales revenue object in the table with the new variable. Ex.3 To use the In and Where context operators
  • 12. 12 9/25/2013 Footer 5. Create the Sales revenue for all States calculation by dragging and dropping the Sales revenue object from the Data tab and dropping it outside the table anywhere in the report space. 6. Insert a free-standing cell to the left of this calculation and enter text that identifies the calculation. 7. Create the Highest Sale Revenue for any one State variable using this syntax: =Max([Sales revenue] In ([State])) This context uses the In operator to specify Input context. This assures that the calculation only addresses the State values when locating a maximum amount. There is no output context defined, so the calculation uses the default output context of the entire report, because it was placed at the report level rather than in a table. 8. Drag the new variable in the report space and insert a free-standing cell with text that identifies the calculation. 9. Create the Highest Annual Revenue for California variable using the following syntax: =Max([Sales revenue] In([State];[Year]) Where([State]="California")) This variable definition uses both the In and Where operators to achieve the correct calculation. Both operators were used in defining the Input context. - The In operator forces the =Max function to look in the State values first and then the Year values within each State in order to locate the maximum value. - The Where operator assures that the =Max calculation is only valid where the State is California. Ex.3 To use the In and Where context operators (cont)
  • 13. 13 9/25/2013 Footer 10. Create the Sales revenue for California for 2003 variable using this syntax: =[Sales revenue] Where([State]="California' And [Year] =2003") Like the Sales revenue By Year for California object, this calculation uses the Where operator in the Input context to ensure that the calculation is valid for only those values denoted by the Where operators. It is not necessary to list the components of the calculation in order of granularity when using the Where operator. You must list the components when using the In operator. 11. Insert this variable in the report and insert another free-standing cell with text to identify the calculation. Ex.3 To use the In and Where context operators (end)
  • 14. 14 9/25/2013 Footer 1. In the new report, press the Ctrl key and drag the Year and Sales revenue objects to create a new vertical table. 2. Create a Max Quarterly Revenue variable with the following input context: =Max([Sales revenue]ForEach([Quarter])) In ([Year]) 3. Insert the new variable in the table. The Year dimension is the default input context in the block. By using the ForEach operator, you add the Quarter dimension to the context, giving an input context of ([Year];[Quarter]). Ex.4 To use the ForEach context operator
  • 15. 15 9/25/2013 Footer 1. In the new report, press the Ctrl key and drag the Year, Quarter and Sales revenue objects to create a new vertical table. 2. Click the Sales revenue column and apply a sum. The standard sum function inserts a footer in the table and displays the total revenue for all quarters in the three years, using the default calculation context. You want to display the total revenue for each year. But to total revenues by year the the input context needs to be (Year); by default, it is (Year; Quarter). Therefore, you need to remove Quarter from the input context by specifying ForAll ([Quarter]) in the formula, which looks like this: =Sum([Sales revenue]) ForAll ([Quarter]) 3. Create a Yearly Total variable with the following input context: =Sum([Sales revenue]) ForAll ([Quarter]) 4. Insert the new variable in the table. Ex.5 To use the ForAll context operator