Forum Discussion

tomperro's avatar
tomperro
Icon for Helper V rankHelper V
1 year ago
Solved

Userelationship return all values for each row

Can userelationship return anything other than an aggregate?

i am trying to get each employee name from my employee table using an inactive relationship.

5 Replies

    • tomperro's avatar
      tomperro
      Icon for Helper V rankHelper V

      Would you be able to give me an example of how the dax should look?

      thank you in advance 

  • If you mean by "each employee" all values, you can't do that with a calculated column or a measure. They must always return a scalar value  - aggregate or concatenated values. You can return each employee in a separate table.

  • v-achippa's avatar
    v-achippa
    Icon for Community Support rankCommunity Support

    Hi tomperro,

     

    Thank you for reaching out to Microsoft Fabric Community.

     

    Thank you pankajnamekar25 for the prompt response

     

    The USERELATIONSHIP function in DAX can be used to activate an inactive relationship between tables, which can then be used in your calculations.

     

    Here’s an example measure that demonstrates how to use USERELATIONSHIP to get a list of employee names using an inactive relationship:

     

    USERELATIONSHIP activates the inactive relationship between Employee[EmployeeID] and Department[EmployeeID]. Normally, the active relationship may be between Employee[DepartmentID] and Department[DepartmentID].

     

    EmployeeNames = 
    CALCULATETABLE (
    Employee[EmployeeName],
    USERELATIONSHIP (Employee[EmployeeID], Department[EmployeeID]) 
    )

     

    If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

     

    Thanks and regards,

    Anjan Kumar Chippa

  • v-echaithra's avatar
    v-echaithra
    Icon for Community Support rankCommunity Support

    Hi tomperro ,

    As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
    If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.

     

    Regards,

    Chaithra.