Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

active the relationship and create measure

Hi, I am making a report that represent sale achievement rate among two years.

I want to create measure(% achievement rate) in target table. 

The problem is the relationship between date table and target is inactive. I know USERELATIONSHIP() can active the relationship but i don't how to deal with it exactly. Thanks

 

  • Hey Anonymous ,

     

    you can activate an inactive relationship using USERELATIONSHIP as you already mentioned but from the picture you provided, it seems you have to "deactivate" the existing relationship between the table "Date table" and "Sales" to avoid circular dependencies. This can be done by creating a measure like so:

    measure =
    CALCULATE(
        <the formula that creates a values> //the calculation of the value
        , USERELATIONSHIP( 'Date table'[Year] , 'Target'[Target Year] ) //activates an inactive relationship
        , CROSSFILTER( 'Date Table'[Date] , 'Sales'[Date] , None ) //deactivates an existing relationship
    )

    Hopefully, this provides what you are looking for.

     

    Regards,

    Tom

2 Replies

  • Hey Anonymous ,

     

    you can activate an inactive relationship using USERELATIONSHIP as you already mentioned but from the picture you provided, it seems you have to "deactivate" the existing relationship between the table "Date table" and "Sales" to avoid circular dependencies. This can be done by creating a measure like so:

    measure =
    CALCULATE(
        <the formula that creates a values> //the calculation of the value
        , USERELATIONSHIP( 'Date table'[Year] , 'Target'[Target Year] ) //activates an inactive relationship
        , CROSSFILTER( 'Date Table'[Date] , 'Sales'[Date] , None ) //deactivates an existing relationship
    )

    Hopefully, this provides what you are looking for.

     

    Regards,

    Tom