Provide automatic sorting

The goal of this example is to provide automatic sorting of an attribute in report visuals. Specifically, the United States regional organizations should appear next to one another by default in visuals. By default, the Central Division (a part of the USA), appears between Canada and France given the alphabetical sorting of text columns:

  1. Add a Table.Sort() expression to the import query for the Organization dimension.
    • The columns for the sort should be at the parent or higher level of the hierarchy.
  1. Add an expression with the Table.AddIndexColumn() function that will add a sequential integer based on the table sort applied in step 1.
Figure 43: Sort Order and Index Column Expressions
  • With this expression, ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.