Forum Discussion

RingoMoon's avatar
RingoMoon
Frequent Visitor
2 years ago
Solved

Creating a new calculated column makes an existing calculated column blank

I have a table which contains event name, event edition code(year), revenue and then a calculated column called Prior Year which derives the prior year based on the last year with non blank revenue. ...
  • rajendraongole1's avatar
    2 years ago

    Hi RingoMoon - Hope you have first created the prior year column then key column.You can check the dependency view in Power BI to see how columns are dependent on each other.

     

    Slight modification in Prior Key calculation:

    Prior Year =
    VAR CurrentYear = 'Events'[EventEditionCode]
    VAR EventName = 'Events'[EventName]
    RETURN
    CALCULATE(
    MAX('Events'[EventEditionCode]),
    FILTER(
    'Events',
    'Events'[EventName] = EventName &&
    'Events'[EventEditionCode] < CurrentYear &&
    NOT(ISBLANK('Events'[Revenue]))
    )
    )

     

    Now define your key column :

    key =
    CONCATENATE(
    'Events'[EventName],
    'Events'[EventEditionCode]
    )

     

    try the above calculation and make sure the key column and prior key columns are not dependant each other (circular dependency). Hope it works . please try

     

    Did I answer your question? Mark my post as a solution! This will help others on the forum!
    Appreciate your Kudos!!