none
Excel Power Query Advanced Editor breaking code into steps RRS feed

  • Question

  • I was creating a new query in power query and opened advanced editor to duplicate one of the steps (copied a line of code and changed column name)

    The query works fine but all the steps have disappeared from the "Applied Steps" menu on the right and merged into a single step.

    How do I break these into small steps again (which is a lot simpler to understand and troubleshoot)?

    Does this happen every time the advanced editor is used?

    My code below. Can I somehow have each line show as a separate step in the "applied steps" menu on the right?

    Thank you, RY


    • Edited by RY33 Thursday, April 25, 2019 2:19 PM
    Thursday, April 25, 2019 2:19 PM

Answers

  • Power query code is typically written like this:

    let
        step1 = blah blah,
        step2 = blah(step1 blah),
        step3 = blah(step2, blah)
    in
        step3

    So if you add a new step, remember that the next steps have to reference it, and the step at the last line after "in" should be the last step. You probably forgot to change the step name after "in"

    • Marked as answer by RY33 Thursday, April 25, 2019 3:24 PM
    Thursday, April 25, 2019 2:25 PM

All replies

  • Power query code is typically written like this:

    let
        step1 = blah blah,
        step2 = blah(step1 blah),
        step3 = blah(step2, blah)
    in
        step3

    So if you add a new step, remember that the next steps have to reference it, and the step at the last line after "in" should be the last step. You probably forgot to change the step name after "in"

    • Marked as answer by RY33 Thursday, April 25, 2019 3:24 PM
    Thursday, April 25, 2019 2:25 PM
  • Thank you, S.Risemann - great answer - managed to fix my query and understand the structure now, so can use advanced editor. I was simply copying the the last line of code and changing the "blah" bit without adjusting the references to previous steps - hence didn't work as expected.
    • Edited by RY33 Thursday, April 25, 2019 3:29 PM
    Thursday, April 25, 2019 3:28 PM