[Table].FindColumn

Prev Next

General

The [Table].FindColumn can be used in Column Numbers property of a Table Element to Find the number of the column according to the header and use it together with the CreateList function.

Syntax

The syntax of the [Table].FindColumn function is:

[Table].FindColumn Function Syntax

[Table].FindColumn ("header")

Examples

[Table].FindColumn Function Example

In a table with 2 columns: Dimension 1 and Measure 1, [Table].FindColumn("Dimension 1") will return 1:
[Table].FindColumn("Dimension 1")

[Table].FindColumn Function Example

It is possible to use expressions in case the Headers are dynamic:
CreateList ( [Table].FindColumn(“name of column1”) , [Table].FindColumn(“name of column2”), [Table].FindColumn(“YTD Sales ” & Date.Now.Year) )

If one of the columns is not found, an exception will be thrown and the Report will fail. In contrast, when using FindOptionalColumn, the error will be ignored and the table will not contain this column.