Forum Discussion

albertax's avatar
albertax
Frequent Visitor
2 years ago

Calculated Use Relationship is not returning count

Hi Team, 

 

I have two tables that are joined together by an inactive relationship, many to many both directions.


Table A: Name

Table B: CompletedByName

 

My measure is not returning the desired result:

 

This is my measure which is a calculated measure: 

 

CALCULATE(

COUNTROWS(Table A),

TREATAS(VALUES('Table A'[Name]), Table B[CompletedByName])

)

 

Any ideas? This has been going no where for me for a few hours

 

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi albertax 

    Your relationship is inactive, you need to use USERELATIONSHIP() function to active the relationship.

    Measure =
    CALCULATE (
        COUNTROWS ( 'Table A' ),
        USERELATIONSHIP ( 'Table A'[Name], 'Table B'[CompletedByName] )
    )

     And you can refer to the following information about the function.

    USERELATIONSHIP function (DAX) - DAX | Microsoft Learn

     

    Best Regards!

    Yolo Zhu

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