Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Circular Dependency: Pls Help

Hi Experts,

 

I am getting this error, while am creating calculated coloumn, How to rectify it. Please help.

 

  • Fowmy's avatar
    Fowmy
    5 years ago

    Anonymous 

    I have added the Max Buiness Date logic for each customer and modified the code. please try:

    BALFUNDS =
    VAR _BALFUNDS = Holdings[market_value_in_usd]
    VAR __MaxBusDate =  CALCULATE( MAX( Holdings[BusinessDate]), ALLEXCEPT(  Holdings ,  Holdings[Customer_No] ) ) 
    RETURN
        IF (
            Holdings[BALFUNDS_CC] = "Funds" &&  Holdings[BusinessDate] = __MaxBusDate,
            SWITCH (
                TRUE (),
                _BALFUNDS >= 0
                    && _BALFUNDS < 2000000, "<6m",
                _BALFUNDS >= 2000000
                    && _BALFUNDS < 5000000, "4m-<4m",
                _BALFUNDS >= 5000000
                    && _BALFUNDS < 10000000, "4m-<8m",
                _BALFUNDS >= 10000000
                    && _BALFUNDS < 20000000, "10m-<20m",
                _BALFUNDS >= 20000000, "No "
            )
        )
    
    

8 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      mahoneypat 

       

      This is the expression for (Max_BusinessDate)

  • Anonymous 

    Remove the filter from the Holdings table. 

    Try your column this way:

    BALFUNDS = 

    CALCULATE (
       YOUR CODE GOES HERE...,
       REMOVEFILTERS ( 'HOLDINGS')

    )

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Fowmy

      Can you Type here where should make changes?

      This is my DAX Column 

       

      BALFUNDS =
      var _BALFUNDS = if( Holdings[BALFUNDS_CC] = "Funds" && Holdings[BusinessDate] = [Max_BusinessDate],Holdings[market_value_in_usd],BLANK())
      return IF (_BALFUNDS>=0 && _BALFUNDS<2000000, "<6m",
      IF(_BALFUNDS>=2000000 && _BALFUNDS<5000000, "4m-<4m",
      IF(_BALFUNDS>=5000000 && _BALFUNDS<10000000, "4m-<8m",
      IF(_BALFUNDS>=10000000 && _BALFUNDS<20000000, "10m-<20m",
      IF(_BALFUNDS>=20000000,"No ")))))

      • Fowmy's avatar
        Fowmy
        Icon for Super User rankSuper User

        Anonymous 

        I am not sure why you need the measure to get the Max business date. you are creating a column and the measure will always give you the last date in the table as there is no filter context during column creation.

        Try the following code:

        BALFUNDS =
        VAR _BALFUNDS = Holdings[market_value_in_usd]
        RETURN
            IF (
                Holdings[BALFUNDS_CC] = "Funds",
                SWITCH (
                    TRUE (),
                    _BALFUNDS >= 0
                        && _BALFUNDS < 2000000, "<6m",
                    _BALFUNDS >= 2000000
                        && _BALFUNDS < 5000000, "4m-<4m",
                    _BALFUNDS >= 5000000
                        && _BALFUNDS < 10000000, "4m-<8m",
                    _BALFUNDS >= 10000000
                        && _BALFUNDS < 20000000, "10m-<20m",
                    _BALFUNDS >= 20000000, "No "
                )
            )