Forum Discussion

learner03's avatar
learner03
Post Partisan
2 years ago
Solved

MAX date based on another column

I have a column with values A & B and a date column which show when the data was updated for A & B.
I need to make a new calculated column, which shows when A was last updated and when B was last updated.

I am using below but it says circlar dependecy-

"

VAR CurrentValue =table1[A&B]
RETURN
    IF(
        CurrentValue = "A",
        CALCULATE(MAXX(FILTER('table1', table1[A&B] = "A" && NOT(ISBLANK('table1[Date update]))), 'table1[Date update])),
        IF(
            CurrentValue = "IFC",
            CALCULATE(MAXX(FILTER('table 1','table1[A&B]= "B" && NOT(ISBLANK(table1[Date update]))), 'table1[Date update])),
            BLANK()
        )
    )

"

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi learner03 ,

    It could be a DAX measure that is causing the circular dependency.
    I tried to create data to reproduce your problem, here are my test steps:
    Test data

    Apply your calculate column

    Here's my modification of this dax to achieve your goal

    LastUpdateDate = 
    CALCULATE(
        MAX('Table'[Date update]),
        FILTER(
            'Table',
            'Table'[A&B] = EARLIER('Table'[A&B])
            && NOT(ISBLANK('Table'[Date update]))
        )
    )

    Final output

    You can refer to this link for more information on cyclic dependencies
    Avoiding circular dependency errors in DAX - SQLBI

     

    Best regards,

    Albert He

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi learner03 ,

    It could be a DAX measure that is causing the circular dependency.
    I tried to create data to reproduce your problem, here are my test steps:
    Test data

    Apply your calculate column

    Here's my modification of this dax to achieve your goal

    LastUpdateDate = 
    CALCULATE(
        MAX('Table'[Date update]),
        FILTER(
            'Table',
            'Table'[A&B] = EARLIER('Table'[A&B])
            && NOT(ISBLANK('Table'[Date update]))
        )
    )

    Final output

    You can refer to this link for more information on cyclic dependencies
    Avoiding circular dependency errors in DAX - SQLBI

     

    Best regards,

    Albert He

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly