Search code examples
powerbidax

USERELATIONSHIP function can only use the two columns references participating in relationship


I am trying to create measures which use different date columns within the same table. I have an order date and a shipment date. I want to compare how many orders are received on each week day with the amount of orders that are shipped on each weekday. I have a separate DATE table and I am using the 'USERELATIONSHIP' function in DAX. This is the main orders table:

enter image description here

As you can see, there are two columns with order date and ship date. This is the DATE table:

enter image description here

The relationship between these tables is by default, between the 'Order Date' column and 'DATE[Date]' table/column. This is the formula I have where I use the USERELATIONSHIP function:

Shipped-volumes = CALCULATE(COUNTROWS('DIM-Order'), USERELATIONSHIP('DIM-Order'[Ship Date], 'DATE'[Date]))

I am receiving the error message:

'USERELATIONSHIP function can only use the two columns references participating in relationship.'

Any ideas why?


Solution

  • In order to use USERRELATIONSHIP function you need to create an inactive relationship between 'DIM-Order'[Ship Date] and 'DATE'[Date].

    Visit : https://www.sqlbi.com/articles/using-userelationship-in-dax/