Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

circular dependency --help please

hi

 

i am just trying to relate tables using bridge table . where i am facing the circlaur dependency .

 

dim:

feedyard

sex

ration

 

data table :

feedyard sex ration index

alex bike 1200 0

alex car 6000   1

alex house 2000 2

 

created the bridge table :

check = CROSSJOIN(VALUES(data[Index]),VALUES('dimension'[dim]))
 
This is the error i am facing can anyone help here?
  • Hi Anonymous

    1. copy "dimension" and paste, then i get "dimension2" table,

        in this table with only one column, "remove rows"->remove duplicates

    2. copy "data" and paste, then i get "data2" table,

        in this table, click on the [index] column and select "Remove other columns", then Removed Duplicates

    3.in "dimension2" table, add a custome column

     

    Then expand this column

     

    Best Regards

    Maggie

12 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    What does your overall table structure look like?  Do you have many bi-directional relationships?  Bi-directional 1 to many relationships are often the easy way to fall prey to this issue.  The other cause could be if you have created a loop within your actual structure, whereby you might have to make a relationship inactive and make use of USERELATIONSHIP in dax if there is a special case.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      HI Anonymous

       

      i dont have any tables other than 3 .Ataching the screenshot . Do you mean that table which i am creating by the use of cross join is causing the issue ?

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        I notice the Cardinality and Filter direction are blank.  Those options shouldn't be blank, and it shouldn't even let you select blank.  Something is very broken here.

         

        Are you able to select cardinality?

  • v-juanli-msft's avatar
    v-juanli-msft
    Community Support

    Hi Anonymous

    You use 'dimension'[dim] to create the bridge table, then create the relationship between 'dimension' and "check" table, so it occurs an error for circular dependency.

    More introduction about avoiding circular dependency please read this article.

     

    As a workaround, you could create this bridge table in Edit Queries.

    Create a blank query, then paste the following code in Advanced editor

    let
        Source1 = dimension,
        #"Removed Duplicates" = Table.Distinct(Source1),
        Source2 = data,
        #"Removed Other Columns" = Table.SelectColumns(Source2,{"index"}),
        #"Removed Duplicates2" = Table.Distinct(#"Removed Other Columns"),
        addcolumn=Table.AddColumn(#"Removed Duplicates", "index", each #"Removed Duplicates2"),
        #"Expanded index" = Table.ExpandTableColumn(addcolumn, "index", {"index"}, {"index.index"})
    in
        #"Expanded index"

     

    Or you can edit the table steps by steps with the UI 

    1.Query1:

    copy and paste the 'dim' table->Removed Duplicates

    2.Query2:

    copy and paste the 'data' table->click on the [index] column and select "Remove other columns"->Removed Duplicates

    3.in Query1:

    Add column from Query2 , then expand the column

     

    Best Regards

    Maggie

    • Anonymous's avatar
      Anonymous
      Not applicable

      hi v-juanli-msft

       

      will this table gets refreshed will scheduled in prod?. I mean if the values (attributes)gets added to the dimension ( productname say) will this data be also reflects to the bridge table automatically without manual intervension?

       

      one more question : if i paste the query using query editor will this query creates other two tales and then join ?. Will this step refreshes the data in bridge table  based on data change other two tables ?

      • Anonymous's avatar
        Anonymous
        Not applicable

        hi v-juanli-msft

        3.in Query1:

        Add column from Query2 , then expand the column .

         

        can you send me screenshot how you did this  from query editor . I am not able to add column from another table .can you help here ?