Skip to main content

topColumns

Returns the top N columns in a table region.

If N = 3, the output is the first three columns in the region, working left to right.

The first column — i.e. the row names column — isn't counted as Column 1. See the examples for guidance.

The output is always a table region, but a single-column region is printed as a list of values

Note

Available in "Describe the Table" and "Describe Row in Context" projects only.

Parameters

  • TABLE REGION (table region)

    The input table region.

  • N (number)

    The number of columns to select.

    If N = 3, the output is the input region's first three columns.

    The row names column is not counted.

Examples

Branch

Orders

salesRev

COGS

otherRev

otherExp

netProfit

Row 1

Aberdeen

15

14,000

8,000

2,000

1,500

6,500

Row 2

Edinburgh

35

33,000

19,000

2,000

3,500

12,500

Row 3

Inverness

18

16,000

8,250

1,200

1,500

7,450

Note

The first column — Branch in the table above — contains the row names. The function does not count this column, so Orders is Column 1, salesRev is Column 2, and so on.

The first parameter defines the table region, while the second defines the number of columns.

ATL in Script

Result

[[topColumns(WholeTable, 2)]]

Orders

salesRev

Aberdeen

15

14,000

Edinburgh

35

33,000

Inverness

18

16,000

[[topColumns(WholeTable, 3)]]

Orders

salesRev

COGS

Aberdeen

15

14,000

8,000

Edinburgh

35

33,000

19,000

Inverness

18

16,000

8,250

Note

The row names — in this case, the Branch values — are included in the output region.