Forum Discussion

rodneyc8063_1's avatar
5 years ago
Solved

Power Query M Code - {0}[Data] Meaning?

Apologies in advance for the cryptic forum title.

 

I am studying Power BI at the moment, and was going through this following article on Power Query M Code

 

https://docs.microsoft.com/en-us/power-query/power-query-quickstart-using-power-bi#the-advanced-editor

 

In the example code given it states the following (very roughly)

 

let
    Source = Web.Page(.......),
    Data0 = Source{0}[Data],
    #"Changed Type" = Table........
    #"Changed Type1" = Table........
in
    #"Changed Type1"

 

I was looking at the example provided of the code in the "Advanced Editor" and I cant quite piece together what line 3 is doing in the code. 

 

Specifically the line that says

 

Data0 = Source{0}[Data]

 

If I understand correctly, Data0 is a new step which is equal to Source{0}[Data]. 

 

Source is referring to the previous step, and [Data] is a column.

 

So I am confused what is happening when its also got the extra {0} sandwiched in between?

 

I tried to search around, and the closest thing I could find was referring to {0} as possibly a "list", or a data value? But I think I am terribly off course here and was hoping for some guidance.

 

Thanks in advance

2 Replies

    • rodneyc8063_1's avatar
      rodneyc8063_1
      Helper V

      Thanks so much for this!

       

      That article is exactly what I am looking for 🙂

       

      So to summarize, this is used for Power Query M language "cell navigation"

       

      Taken from the article: StepName{RowIndexNumber}[Column] and this specific RowIndexNumber is one that is automatically generated by Power Query. Power Query has its own index and it starts from 0, so if you’re trying to get the first row of a list or a table, you’d use {0}

       

      I was able to do further reading, and syntax wise its acceptable to either use 

       

      StepName{RowIndexNumber}[Column] or StepName[Column]{RowIndexNumber}

       

      These will both essentially produce the same result, but the difference is the sequence or order of steps. Either it can pull the record first, then the specific column OR it can just pull the column and then get the record. 

       

      Thanks for the clarification! Again much appreciated!