Forum Discussion

butterscotch's avatar
butterscotch
Helper II
2 years ago

A circular dependency

Hello Everyone !

im facing an issue where i want to create a column using a measure but an error arise ,
the issue 

the formula for completion Feb

Completion Feb = 
IF(
   VALUES('Master'[Start Date].[Date]) <= MAX('Master'[Feb-24]) &&
    VALUES('Master'[End Date].[Date]) >= MAX('Master'[Feb-24]),
    1,
    0
)

formula for Jan-24-Rev0

Jan-24-Rev0 = [Completion]

 formula for completion

Completion = 
IF(
    MAX('Master'[Start Date].[Date]) <= MAX('Master'[Jan-24]) &&
    MAX('Master'[End Date].[Date]) >= MAX('Master'[Jan-24]),
    1,
    0
)


thank you for helping ! 

5 Replies

  • Hi butterscotch 

     

    Calculated columns are calculated on refresh before any visuals, slicers etc are active.  That includes measures as well since they rely on context and there is no context at that point.

     

    Not a best practice.

      • gmsamborn's avatar
        gmsamborn
        Super User

        There is an order of evaluation.  If a calculated column uses a measure that relies on context (filters, slicers), it might work when writing it because the slicer would have a selection (creating context).  On the other hand, when a refresh is being done, there are no slicers or filters active because they aren't evaluated until after the refresh is complete.

         

        I hope that makes sense.

  • saud968's avatar
    saud968
    Memorable Member

    There is a workaround that I used in one of my projects by creating a reference Table based on the OG table

    WeekUniqueTicketTable =
    ADDCOLUMNS(
        Master(Your Table Name),
        "Master2(New Table Name)", [Any Column Name as Reference]
    )

    Best Regards
    Saud Ansari
    If this post helps, please Accept it as a Solution to help other members find it. I appreciate your Kudos!