The Navigation Step’s Name

, ,

If you’ve worked in Power Query’s advanced editor for any length of time, you’ve probably figured out that the step names displayed in the UI are simply the variable names from the query’s main let expression.

This holds true, except in one case: The navigation step.

If a query’s let expression defines a variable for a data source and then follows this with a variable which uses the previous variable to navigate to a dataset it exposes, the second variable’s name won’t show up in the step list. Instead, the step name for it will default to “Navigation”—and that name can’t be changed in the UI.

Both expression variations below have their steps listed as “SomeSource”, “Navigation” in the UI.

let
    SomeSource = Sql.Database("SomeServer", "SomeDB"),
    NameNotDisplayedInStepList = SomeSource{[Schema="dbo",Item="SomeTable"]}[Data]
in
    NameNotDisplayedInStepList
let
    SomeSource = Sql.Database("SomeServer", "SomeDB"){[Schema="dbo",Item="SomeTable"]},
    NameNotDisplayedInStepList = SomeSource[Data]
in
    NameNotDisplayedInStepList

This behavior only occurs if the data source and navigation variables are defined immediately adjacent to each other. If another variable is inserted between the two, the data navigation variable’s name shows up as its step name in the UI list. Also, this substituting “Navigation” as the step name only applies to the first source + navigation variable pair in an expression. If an expression contains multiple of these pairs, the latter pairs will have their step names show up verbatim, even if the step name override did not occur for the first pair because an intervening variable is present between it.

If a query’s let expression contains a variable named Navigation and a source + navigation pair of variables, the step list can show the name “Navigation” twice. This is the only case I’m aware of where the same name can appear multiple times in that list.

let
    Source = Sql.Database("SomeServer", "SomeDB"),
    NameNotDisplayedInStepList = Source{[Schema="dbo",Item="SomeTable"]}[Data],
    Navigation = Table.SelectColumns(NameNotDisplayedInStepList, {"Directions"})
in
    Navigation 

Partly, these details are interesting trivia, for the fun of it. Partly, maybe they will help you if you ever end up puzzled by this special behavior of step names. However, they also tie to the file format used to store Power Queries (something of particular interest to me of late).

It turns out that the name used for a query’s navigation step is controlled by its NavigationStepName entry in the data mashup’s Metadata.xml. To see this using Data Mashup Explorer, open a file, select Metadata.xml, find the query of interest, and look at the entry named “NavigationStepName”. Power Query sets its value to “Navigation” and does not expose a way to change this value. Technically, though, if through some programmatic means you modify this value, the UI step list will reflect your change.

Here’s the step list for the query we started with after a little metadata tweaking:

For what it’s worth, now you know. What I’m curious to know more about is the story behind why the navigation step was given this special naming behavior.

1 thought on “The Navigation Step’s Name

  1. Konrad Schaefers

    Hi Ben, this is really intriguing and I would love to find out the reasoning for this special treatment, too.

    I personally find it really annoying that I can’t change the name. Also it combines sometimes multiple navigation steps into one.
    Lastly, in some cases I am not even allowed to change the “Source”-Step name, which also seems like an arbitrary limitation.

    Keep shedding light on these inner (strange) M-workings! Highly appreciated.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *