Forum Discussion

Italian8's avatar
Italian8
Frequent Visitor
1 year ago
Solved

2 separate Calculations in 1 Measure

Is there a way to create 1 measure that contains 2 seperate calculcations that i based on a condition? the condition being a date range or if column equal certain Value? 
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Italian8,

    Thanks for the reply from bhanu_gautam.

     

    The reason you need to aggregate when using columns directly in a measure is that the engine doesn’t know how to handle multiple rows or entries in a column without an explicit aggregation, which is the way DAX works.

     

    Actually, measures are context-sensitive, and aggregations like MAX, MIN, SUM, etc., help define how to handle multiple values. 

     

    As a workaround, you could consider SELECTEDVALUE(), which returns the value from the current context:

    Measure = IF(SELECTEDVALUE(Table[DateColumn]) < TODAY(), 1, 0)

     

    Best Regards,
    Qi
    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!