Select columns

  1. Use the Table.SelectColumns() function to accomplish the following:
    • Explicitly define the only columns retrieved
    • Set the presentation order of the columns in the Query Editor
    • Avoid query failure if one of the source columns changes or is missing
  • In this example, 29 columns are available from the AdventureWorks Customer Dimension table, but only 11 are selected
Figure 64: The Expression for Selecting Columns
  • The MissingField.UseNull parameter is optional but recommended
  • If a column selected isn't available or is renamed in the source database, the query will still succeed (see Figure 65):
Figure 65: Columns from the ...

Get Microsoft Power BI Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.