Forum Discussion

unknown917's avatar
unknown917
Helper IV
1 month ago
Solved

Dynamic Filter creation based on multiple criteria

I have multiple data sources that externally refresh at different periods of time.  1 monthly, the other every day.  I need my visuals to only show complete data and thus it needs to filter out anyth...
  • Prince0011's avatar
    1 month ago

    A visual-level filter can't directly use a measure to remove rows because measures are evaluated after the filter context has already been established. For a dynamic scenario like yours, it's usually better to create a flag that identifies whether a cycle is complete and use that in your visuals.

    Here are a few approaches you could consider:

    Option 1 (Recommended): Create a "Complete Cycle" flag

    If your cycle boundaries are already defined, create a calculated table/column (or compute it upstream in Power Query/Dataflow) that determines whether each cycle is complete.

    For example, a cycle is complete when:

    • It contains at least 15 distinct days.

    • The cycle has ended (or meets your business completion criteria).

    Then use this flag as a visual, page, or report filter.

    Complete Cycle =
    IF (
        [Distinct Days in Cycle] >= 15
            && [Cycle End Date] <= TODAY(),
        TRUE(),
        FALSE()
    )

    If [Distinct Days in Cycle] is a measure, consider calculating the flag during data preparation instead of as a calculated column.

    Option 2: Use a Cycle dimension table

    If you already have a table that defines your cycle periods, add attributes such as:

    • Cycle ID

    • Start Date

    • End Date

    • Distinct Day Count

    • Is Complete

    Relate this table to your fact tables and filter on Is Complete = TRUE.

    Option 3: Handle it during ETL

    Since your sources refresh on different schedules (monthly vs. daily), another common approach is to determine "complete" during the ETL process:

    • Calculate cycle completeness in a Dataflow, Fabric Pipeline, or SQL.

    • Persist only completed cycles (or add a completion flag).

    • Let Power BI simply consume the prepared data.

    This is often more efficient and easier to maintain than implementing complex DAX logic.

    Overall, if the definition of "complete" depends on multiple datasets refreshing at different times, I would recommend moving that logic as close to the data source as possible (Power Query, SQL, Dataflow, or Fabric Pipeline). It simplifies your report and ensures all visuals consistently use the same business rule.

    For more information:

    💡 Helpful? Give a Kudos 👍 — keep the community growing.

    Solved your issue? Mark this as the Accepted Solution ✔️

    Best regards, Prince Singh | Data Science & Microsoft Fabric Enthusiast