Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Why this RELATED function does not work?

Hello

 

Can you tell me please why this formula does not work?

 

 

CALCULATE(COUNT(DifferentTable[Col1]),filter(DifferentTable,DifferentTable[Col2]=RELATED(SameTable[Col1])))

 

 

I get the following error:

 

The column 'SameTable[Col1]' either doesn't exist or doesn't have a relationship to any table available in the current context.

 

 

Thanks!

 

  • Hi Anonymous ,

    Is there any relationship between these two tables? 

    If there is no relationship between them, you cannot use related() function. If they have a relationship actually, try to use relatedtable() function.

    Related() is used to refer to One side of a relationship. 

    RELATEDTABLE() refer to the many side.

    Please refer this article about related and relatedtable: Related and RelatedTable – DAX for Power Pivot, Power BI and SSAS 

     

    Best Regards,
    Yingjie Li

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • v-yingjl's avatar
    v-yingjl
    Community Support

    Hi Anonymous ,

    Is there any relationship between these two tables? 

    If there is no relationship between them, you cannot use related() function. If they have a relationship actually, try to use relatedtable() function.

    Related() is used to refer to One side of a relationship. 

    RELATEDTABLE() refer to the many side.

    Please refer this article about related and relatedtable: Related and RelatedTable – DAX for Power Pivot, Power BI and SSAS 

     

    Best Regards,
    Yingjie Li

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

  • Mariusz's avatar
    Mariusz
    Community Champion

    Hi Anonymous 

     

    You can use related if you are trying to reach a column in a table that on one side (1:*) of the relationship.

    What is that you are trying to achieve and are you creating a Column or Measure?

     

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    LinkedIn