Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Filter rows in Power BI Matrix Based on Measure

I have a total of 3 tables - DIM_TARGET, FACT_PRODUCT, DIM_CALENDAR DIM_TARGET (shown in below Excel), contains product information and the target as well as the start of the target's effective date...
  • rajendraongole1's avatar
    2 years ago

    Hi Anonymous -Create below measure to filter products based on the effective date

     

    EffectiveDate =
    VAR _MaxSlicerDate = MAX(DIM_DATE[DATE])
    VAR _MaxEffectiveDate =
    MAXX(
    FILTER(
    ALL(DIM_TARGET),
    DIM_TARGET[EFFECTIVE DATE] <= _MaxSlicerDate
    ),
    DIM_TARGET[EFFECTIVE DATE]
    )
    RETURN
    IF(
    MAX(DIM_TARGET[EFFECTIVE DATE]) = _MaxEffectiveDate,
    1, // Use a flag value to indicate that this row should be displayed
    0 // Use a flag value to indicate that this row should not be displayed
    )

     

    Hope it works