Skip to main content

Power BI

New

PowerQuery M-Code: special symbol for previous step name

Vote (9) Share
Deniss Sipcenko's profile image

Deniss Sipcenko on 21 Oct 2022 16:23:26

UserStory: in 99% cases we use previous name as input for current step - very annoying and difficult to read, not comfortable to type and edit (it's always a double work).

Proposal: reserve some special symbol (#, for instance) for previous step name (like "_" for each)

This feature would be very useful for advanced users, who works more with Advanced Editor than with GUI.


Metacode Example:

Instead of this:

 let
    Source = someLoadDataFunction(...),
    #"Step 1"  = someFunction1 (Source, ....),
    #"Nice Step 2"  = someAdvancedFunction2 (#"Step 1", ....),
    #"Clever Step Name 3"  =  someVeryAdvancedFunction3 (#"Nice Step 2", ....),
    #"beautiful Step 4"  = someSmartCode4 (#"Clever Step Name 3", ....),
    Result     = someGeniousCode5 (#"beautiful Step 4", ....),
in
    Result


 It would be nice to use this syntax:

 let
    Source = someLoadDataFunction(...),
    #"Step 1"  = someFunction1 (#, ....),
    #"Nice Step 2"  = someAdvancedFunction2 (#, ....),
    #"Clever Step Name 3"  =  someVeryAdvancedFunction3 (#, ....),
    #"beautiful Step 4"  = someSmartCode4 (#, ....),
    Result     = someGeniousCode5 (#, ....),
in
    Result


Post with screens available here

Comments (2)
Deniss Sipcenko's profile image Profile Picture

Josh Turnbull on 17 Feb 2025 12:18:19

RE: PowerQuery M-Code: special symbol for previous step name

Very necessary for the scenarios where we need to move steps around, and risk breaking references that are hard to debug in an already very-hard-to-debug language. Since order of operations is intrinsic to power query, relativising references would make it far easier to work with code rather than the restrictive GUI.Would be good to be able to traverse multiple steps backwards in cases where the step before is not the table you intend to operate on, but retrieves some value you need, e.g.:let Step1 = loadData(...), Step2 = ([params...]) => [function definition], Step3 = Table.AddColumn(# - 1, "NewColumn1", each Step2([params...]))in Step3

Deniss Sipcenko's profile image Profile Picture

Denis Sipchenko on 21 Oct 2022 16:39:53

RE: PowerQuery M-Code: special symbol for previous step name

Is it possible to edit posts?