Forum Discussion

ipezakas's avatar
ipezakas
Helper I
1 year ago
Solved

Measure doesnt work as expected inside VAR

Hello community!  I have the following issue:  I have created a visual table with project_id and time to market column. i have created 2 measure that calculate the topthreshold/bottomthreshold  f...
  • bhanu_gautam's avatar
    1 year ago

    ipezakas Create the measures for thresholds:

    DAX
    TopThreshold =
    PERCENTILEX.INC(
    FILTER(ALLSELECTED(Projects), Projects[TIME_TO_MARKET_(TtM)] >= 0),
    Projects[TIME_TO_MARKET_(TtM)],
    1 - [Percentile] / 100
    )

    BottomThreshold =
    PERCENTILEX.INC(
    FILTER(ALLSELECTED(Projects), Projects[TIME_TO_MARKET_(TtM)] >= 0),
    Projects[TIME_TO_MARKET_(TtM)],
    [Percentile] / 100
    )

     

    Create a measure for the outlier flag:

    DAX
    (TtM) Outlier Flag Measure =
    VAR CurrentTtM = SELECTEDVALUE(Projects[TIME_TO_MARKET_(TtM)])
    VAR BottomThreshold = [BottomThreshold]
    VAR TopThreshold = [TopThreshold]
    RETURN
    IF(
    NOT ISBLANK(CurrentTtM) &&
    (CurrentTtM < BottomThreshold || CurrentTtM > TopThreshold),
    1,
    0
    )

     

    Add the (TtM) Outlier Flag Measure to your visual table. This measure will dynamically calculate the flag based on the current filter context applied to the visual.