Forum Discussion

JustyceW's avatar
JustyceW
Frequent Visitor
9 years ago
Solved

How to reference another table in Query Editor (M)

Hello,

 

I am attempting to reference a table for a custom column in the Query Editor mode of Power BI desktop.

 

The formula will be similar to the solution found in the following link

 

"= List.Average(Table.Column(Table2,[EggName]&"NO2"))"

 

What is the syntax for Table2?

 

For example, columns are referenced as [Column1] in M but what is the reference for other tables?

 

Looking forward to your responses.

 

Have a great day!

 

 

  • Just the name of the table, which is equal to the name of the query from which the table is the result.

     

    If the name of the query (table) contains spaces or other special characters, the name must be included in #"....",
    e.g. #"Table name".

     

     

5 Replies

  • MarcelBeug's avatar
    MarcelBeug
    Community Champion

    Just the name of the table, which is equal to the name of the query from which the table is the result.

     

    If the name of the query (table) contains spaces or other special characters, the name must be included in #"....",
    e.g. #"Table name".

     

     

    • JustyceW's avatar
      JustyceW
      Frequent Visitor

      Hello,

       

      It looks like that works! 

       

      The problem now is I am getting an error: 

       

      "Expression.Error: A cyclic reference was encountered during evaluation"

       

      Here is my formula: = List.Count(List.FindText([Initiative],Table.Column(#"Master - Milestones",[IdeaID])))

       

      For context, I am trying to count the number of milestones for each initiative. The initiative is the key for my current table and the foriegn key in the "Master - Milestones" table.

       

      I would be grateful if you could help me resolve this error and achieve my desired output. 

       

      Best,

       

      Justyce

      • MarcelBeug's avatar
        MarcelBeug
        Community Champion

        It's hard to say. Referencing a column in another table is not a problem as such.

        The issue must be related to your entire query structure, e.g. 2 tables referencing each other.