Forum Discussion

rajkumarg1991's avatar
rajkumarg1991
Frequent Visitor
1 year ago
Solved

Filtering Active Employees Within a Selected Date Range in Power BI (Start and End Dates)

Dear All, I'm building a Power BI dashboard where I need to display only those employees who were active at any point during a user-selected date range. An employee is considered active within the ...
  • Ashish_Excel's avatar
    1 year ago

    Hi,

    I have solved a similar question here.

    Hope this helps.

  • v-ssriganesh's avatar
    1 year ago

    Hi rajkumarg1991,
    Thank you for reaching out to the Microsoft fabric community forum.

    I have reproduced your scenario in Power BI using sample data and a disconnected DateTable, as described. I implemented a solution using DAX logic to filter and show only those employees who were active during the selected date range, including cases with blank end dates.

    What I Did:

    • Used a disconnected DateTable as a slicer.
    • Built a DAX measure to identify overlapping employment periods with the selected range.
    • Applied the logic even when multiple appointments per person existed.

    Output:

    The measure correctly returns employees who were active at any point within the selected date range, matching your expectations.

    I’m attaching the .pbix file here for your reference so you can explore and adapt it to your dataset and visual requirements.

    Thank you, Ashish_Excel & sevenhills for share your valuable insights.

    If this information is helpful, please “Accept as solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
    Thank you.

  • v-ssriganesh's avatar
    v-ssriganesh
    1 year ago

    Hello rajkumarg1991,

    Thank you for your kind feedback I’m glad the solution worked well in your scenario.

    Absolutely the same DAX filtering logic can be extended to cards, bar charts, and other visuals You can reuse the existing measure (or its logic) inside any visual that aggregates data.

    Use the measure as a visual-level filter (e.g: Is Active in Range = 1) or include its logic inside new measures tailored for each visual.

    If you're using DirectQuery, especially against large datasets, you can consider dynamic M Query Parameters & Field Parameters.

    For this kind of interval-based filtering, where the logic involves comparing start/end dates against a range Using DAX-based virtual filtering (like in your current approach) is still considered the most practical and flexible method, especially when using Import mode or Hybrid tables.


    If your query has been answered, please “Accept as Solution” and Give “Kudos” so others with similar issues can easily find the resolution.
    Thank you.