Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Calculate function with condition on numeric value (previously based on DateAdd)

I`m trying to adjust the following formula after the column type I am using changed from date to Numeric.  Here is the previous calcualtion - which is working fine:  -- Target = var T= CALCULAT...
  • tamerj1's avatar
    3 years ago

    Hi Anonymous 
    Please try

    Target =
    VAR CurrentNew =
        MAX ( 'metrics'[New] )
    VAR T2 =
        CALCULATE ( SUM ( metrics[Sales] ), 'metrics'[New] = CurrentNew + 2 ) * 0.1
    VAR T_2 =
        CALCULATE ( SUM ( metrics[Sales] ), 'metrics'[New] = CurrentNew - 2 ) * 0.1
    RETURN
        COALESCE ( T2, T_2 )