Skip to main content

Power BI

Needs Votes

Apply consistent indentation for multi-line formulas for viewing in advanced editor

Vote (3) Share
John Doggett's profile image

John Doggett on 21 Nov 2018 07:27:28

In the Power Query Editor, it is possible to enter a multi-line formula in the formula bar. For example:

= () => let
Source = SampleIndexedTimeline,
fxFormPath = (_) => if _[parentIndex] <> null then
Number.ToText(_[parentIndex]) & "/" & _[idPath]
else
_[idPath]

When this is examined in the Advanced Editor, it does not indent any line but the first in any sensible way:

let
Source = SampleIndexedTimeline,
fxFormPath = (_) => if _[parentIndex] <> null then
Number.ToText(_[parentIndex]) & "/" & _[idPath]
else
_[idPath],
#"Extract parentIndex" = Table.ExpandTableColumn(Source, "parentRow", {"index"}, {"parentIndex"}),

Every other line is fully indented (and prefixed with the step assignment), but lines 2+ in multiline formulas are not indented.