Implementing Extended Syntax Keywords

Objective

After completing this lesson, you will be able to implement extended syntax keywords

Extended Syntax Keywords

Extended syntax keywords are a form of shorthand that allows you to refer to dimensions without specifying those dimensions explicitly. This helps future-proof reports; if formulas do not contain hard-coded references to dimensions, they will continue to work, even if dimensions are added to or removed from a report.

There are five extended syntax keywords: Body, Block, Break, Report, and Section.

The Body Keyword

The following table describes the dimensions referenced by the Body keyword, depending on where it is placed in a report.

PlacementData Reference
A blockData in the block
A block break (header or footer)Data in the block
A section (header, footer, or outside a block)Data in the section
Outside any blocks or sectionsData in the report

Example of Body Keyword

The body keyword: See text after image for more details.

The report shows Year, Quarter, and Sales revenue, with a break on Year.

The Body column has the formula:

=Sum([Sales revenue]) In Body

The totals in the Body column are the same as the totals in the Sales revenue column because the Body keyword refers to the data in the block. If you were to add the Month object, the figures in the Block column would change to correspond with the changed figures in the Sales revenue column. If you were to place the formula in the report footer, it would return the total revenue for the body.

Note

It is not necessary to specify Sum because the aggregation function of the Sales revenue measure is Sum.

The Block Keyword

The following table describes the dimensions referenced by the Block keyword, depending on where it is placed in a report. The Block keyword often encompasses the same data as the Section keyword. The difference is that Block accounts for filters on a block, whereas Section ignores them.

PlacementData Reference
A blockData in the whole block, ignoring breaks, respecting filters
A block break (header or footer)Data in the whole block, ignoring breaks, respecting filters
A section (header, footer, or outside a block)Not applicable
Outside any blocks or sectionsNot applicable

Example of Block Keyword

The block keyword: See text after image for more details.

In the example, you have a report showing Year, Quarter, and Sales revenue. The report has a section based on Year. The block is filtered to exclude the third and fourth quarters.

The First Half Average column has the formula:

=Average([Sales revenue]) In Block

You can see how the Block keyword takes account of the filter on the block.

The Break Keyword

The following table describes the dimensions referenced by the Break keyword, depending on where it is placed in a report.

PlacementData Reference
A blockData in the part of the block delimited by a break
A block break (header or footer)Data in the part of the block delimited by a break
A section (header, footer, or outside a block)Not applicable
Outside any blocks or sectionsNot applicable

Example of Break Keyword

The break keyword: See text after image for more details.

In the example of a Break, you have a report showing Year, Quarter, and Sales revenue.

The report has break on Year. The Break Total column has the formula:

=Sum([Sales revenue]) In Break

Without the Break keyword, this column would duplicate the figures in the Sales revenue column, because it would use the default output context ([Year];[Quarter]).

Note

It is not necessary to specify Sum because the aggregation function of the Sales revenue measure is Sum.

The Section Keyword

The following table describes the dimensions referenced by the Section keyword, depending on where it is placed in a report.

PlacementData Reference
A blockAll data in the section
A block break (header or footer)All data in the section
A section (header, footer, or outside a block)All data in the section
Outside any blocks or sectionsNot applicable

Example of Section Keyword

The section keyword: See text after image for more details.

In the example, you have a report showing Year, Quarter, and Sales revenue.

The report has a section based on Year. The Section Total column has the formula:

=Sum([Sales revenue]) In Section

The figure in the Section Total column is the total revenue for each year, because the section break occurs on the Year object. Without the Section keyword, this column would duplicate the figures in the Sales revenue column, because it would use the default output context ([Year];[Quarter]).

Note

It is not necessary to specify Sum because the aggregation function of the Sales revenue measure is Sum.

The Report Keyword

The following table describes the dimensions referenced by the Report keyword, depending on where it is placed in a report.

PlacementData Reference
A blockAll data in the report
A block break (header or footer)All data in the report
A section (header, footer, or outside a block)All data in the report
Outside any blocks or sectionsAll data in the report

Example of Report Keyword

The report keyword: See text after image for more details.

In the example, you have a report showing Year, Quarter, and Sales revenue. The report has a column, Report Total that shows the total of all revenue in the report.

The formula for the Report Total column is:

=Sum([Sales revenue]) In Report

Without the Report keyword, this column would duplicate the figures in the Sales revenue column because it would use the default output context ([Year];[Quarter]).

Note

It is not necessary to specify Sum because the aggregation function of the Sales revenue measure is Sum.

Implement Extended Syntax Keywords

Log in to track your progress & complete quizzes