Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Circular dependency

Hello,

can someone help me solve circular depenedncy issue? it is confusing because i am not referring to the culomn at all. 
So i want to calculate the number of rows in my table in a cumulative manner for each date. example

ID     date                             Cumulative_number 

0      01.01.2020 09:00            1

1      01.01.2020 10:00            2

2      05.05.2020  10:00           4

3      05.05.2020  10:00           4

 

 

I have the formula which was actually working but i changed the data source and suddenly it is not working. 

 

Cumulative number= CALCULATE ( [count all IDs], FILTER ( ALL( table), table[date] <= EARLIER ( table[date] ) ) )
 
 
Any suggestions on how I can solve the issue?
  • This is a calculated column.

    RT rows = 
    var d = [date]
    return COUNTROWS(filter('table',[date]<=d))

    Let me know if you need this as a measure.

4 Replies

  • This is a calculated column.

    RT rows = 
    var d = [date]
    return COUNTROWS(filter('table',[date]<=d))

    Let me know if you need this as a measure.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you this resolves my issue! 
      I have another culomn that gives the same error. It seems that the calculate (x, filter)) is causing the circular dependency!


      ID     date                             Cumulative_number   date2               burndown

      0      01.01.2020 09:00            1                               02.02.2020 10:00     1

      1      01.01.2020 10:00            2                               02.02.2020 11:00     2

      2      05.05.2020  10:00           4                               06.05.2020 09:00     2

      3      05.05.2020  10:00           4                                Blank                      2     
      4      06.05.2020  11:00           5                               07.05.2020 11:00     3

       



      Burndown =
      VAR CurrentDate = table[date]
      VAR cumulativeNumber = table[Cumulative Number] (Which now doesn't have circular dependency anymore)
      var PreviousDate=
          CALCULATE(
              MAX(table[date2]),
              FILTER(
                  table,
                  table[date2] <= CurrentDate
                  && NOT(ISBLANK(table[date2]))
              )
          )
          RETURN
          cumulativeNumber -
          COUNTROWS(
              FILTER(
                  table,
                  NOT(ISBLANK(table[date2])) &&
                  table[date2] <= PreviousDate
              )
          )

      Any idea how i can change my formula to avoid the circular dependency?
      • Anonymous's avatar
        Anonymous
        Not applicable

        I did a little workaround. 
        I created the columns like this 

         

        Cumulative date2=
        VAR d = table[date]
        RETURN
            SUMX(
                FILTER(
                    table,
                    table[date2] <= d && NOT(ISBLANK(table[date2]))
                ),
                1
            )
        
        
        burndown = cumulative number- cumulative date2

         


        but it is extremely slow whether I use countrows or sumx with 1.  and I get a memory max error. Any workarounds in mind?