Forum Discussion

AlexaderMilland's avatar
AlexaderMilland
Icon for Helper III rankHelper III
3 years ago

Circular dependency between two calculated columns that uses "UseRelationship".

So in my model i have my order tabel,

where i have an EmployeeID in colunms like 

PickedBy

ShippedBy

ControlledBy etc.

 

I then have an employee table with information like the ID, name etc. that i have related on the employeeid to each and every column where it could be relevant throuh inactive relationships. 

 

 

When i try to create a column on the orders tabel that includes the name from the related table I can only get it to work on 1 column, the rest i get 

 

Essentially i created the "ShipmentBy" measure first and that one totally works. When i try to make new calculated columns I get this circular dependency error.

 

Here is the shipment by column that works.

 

ShipmentBy =
CONVERT(Orders[ShipmentStartBy],STRING)&" ("&
            CALCULATE (
                SELECTEDVALUE ( 'MappingEmployeeID'[Name] ),
                CALCULATETABLE (
                    'Orders',
                    USERELATIONSHIP ( MappingEmployeeID[userid], 'Orders'[ShipmentStartBy] ),
                    REMOVEFILTERS ( 'MappingEmployeeID' )
                )
            )
            &") / "&
CONVERT(Orders[ShipmentCompletedBy],STRING)&" ("&
            CALCULATE (
                SELECTEDVALUE ( 'MappingEmployeeID'[Name] ),
                CALCULATETABLE (
                    'Orders',
                    USERELATIONSHIP ( MappingEmployeeID[userid], 'Orders'[ShipmentCompletedBy] ),
                    REMOVEFILTERS ( 'MappingEmployeeID' )
                )
            )&")"
 
 
Here is the picked column that does not work.
 
PickedBy =
CONVERT(Orders[OrderPickedStartBy],STRING)&" ("&
            CALCULATE (
                SELECTEDVALUE ( 'MappingEmployeeID'[Name] ),
                CALCULATETABLE (
                    'Orders',
                    USERELATIONSHIP ( MappingEmployeeID[userid], 'Orders'[OrderPickedStartBy] ),
                    REMOVEFILTERS ( 'MappingEmployeeID' )
                )
            )
            &") / "&
CONVERT(Orders[OrderPickedCompletedBy],STRING)&" ("&
            CALCULATE (
                SELECTEDVALUE ( 'MappingEmployeeID'[Name] ),
                CALCULATETABLE (
                    'Orders',
                    USERELATIONSHIP ( MappingEmployeeID[userid], 'Orders'[OrderPickedCompletedBy] ),
                    REMOVEFILTERS ( 'MappingEmployeeID' )
                )
            )&")"
 
 
Is it only possible to have 1 calculatetable and userelationship?

2 Replies

  • v-luwang-msft's avatar
    v-luwang-msft
    Icon for Community Support rankCommunity Support

    Hi AlexaderMilland ,

     This error by creating calculated colum?,Why not try with measure? 

     

    If you do have the error with creating a calculated colum, you could have a reference of this similar thread which has been solved.

     

    If you still need help, please share a dummy pbix file which can reproduce the scenario, so that we can help further investigate on it? You can upload it to public link. Do mask sensitive data before uploading.)

     

     

     

    Best Regards

    Lucien