Forum Discussion

Franco's avatar
Franco
Frequent Visitor
3 years ago
Solved

Measure Alert if not between two values

Hello everybody, i have the following problem.   The data model is as follows   I need to find a measure that indicates whether the Rolling Avg Sales 3 Months is out of range (fields from/...
  • tamerj1's avatar
    tamerj1
    3 years ago

    Hi Franco 
    Please use

    NewMeasure =
    VAR From =
        CALCULATE (
            SELECTEDVALUE ( Medels[From] ),
            CROSSFILTER ( Models[ModelID], Items[ModelID], BOTH )
        )
    VAR To =
        CALCULATE (
            SELECTEDVALUE ( Medels[To] ),
            CROSSFILTER ( Models[ModelID], Items[ModelID], BOTH )
        )
    VAR RollingAvg = [Rolling Avg Sales 3 Months]
    RETURN
        IF (
            NOT ISBLANK ( RollingAvg ),
            IF ( RollingAvg >= From && RollingAvg <= To, "IN RANGE", "OUT OF RANGE" )
        )