Forum Discussion

mvinaykumar2003's avatar
mvinaykumar2003
Regular Visitor
1 year ago
Solved

Date Slicer should populate the date range using start date and end date columns using other slicers

Hi,

My Date Slicer date range should be dynamically populated using the start date and end date columns. This date range selection is again controlled by other slicers. Below is the example. 

 

I will have reporting period and Current_Prev_Month slicer, based on the user selection Start date and End date date range should be populated to Date Slicer.

 

 

Appericate any solution or ideas to resolve this scenario.

 

Thanks

  • v-veshwara-msft's avatar
    v-veshwara-msft
    1 year ago

    Hi mvinaykumar2003 ,
    Thanks for the additional details and screenshot.

    I’ve tried this in my setup.

    When Start_Date and End_Date are treated as text, the slicers respond correctly to Reporting_Period and Current_Prev_Month selections .

    this works because Power BI treats them as categorical filters.

     

    However, when using real date types, slicers are designed to show a continuous range and won’t dynamically reduce their range based on slicer-driven logic.


    If your goal is to display the dynamic Start and End Dates:

    Use two text slicers (Start_Date and End_Date)

    If your goal is to filter other visuals based on this dynamic range:

    Please try this:

    Keep a proper Date table:

    DateTable = CALENDAR(DATE(2021,1,1), DATE(2025,12,31))
     

    Use measure like below to identify selected range:

    IsInSelectedRange =
    VAR _min = CALCULATE(
        MIN('Table'[Start_Date]),
        ALLSELECTED('Table')
    )
    VAR _max = CALCULATE(
        MAX('Table'[End_Date]),
        ALLSELECTED('Table')
    )
    RETURN
    IF(
        MAX('DateTable'[Date]) >= _min &&
        MAX('DateTable'[Date]) <= _max,
        1,
        0
    )
     

    Hope this helps. Please reach out for further assistance.
    If this post helps, then please consider to give a kudos and Accept as the solution to help the other members find it more quickly.

    Thank you.

7 Replies

  • v-veshwara-msft's avatar
    v-veshwara-msft
    Community Support

    Hi mvinaykumar2003 ,
    Thanks for using Microsoft Fabric Community.

    Here’s a quick overview of how you could dynamically control your date slicer based on Reporting Period and Current/Previous Month selections:

    Overview:

    • Map each Reporting Period and Current_Prev_Month combination to its corresponding Start_Date and End_Date.

    • Use DAX to dynamically determine the relevant date range based on slicer selections.

    • Use these measures to filter your main date table or apply them as visual-level filters, so only the relevant dates appear in your visuals.

    Please see this link for similar discussion: Use changing or dynamic values of Measure as Slice... - Microsoft Fabric Community

     

    Alternately you could also generate a calculated date table for each range.

     

    To help you further, please provide:

    1. Whether your Start_Date and End_Date columns are in the same table as Reporting Period and Current_Prev_Month.

    2. The structure and format of your date columns.

    3. If you have a separate date dimension table.

    Please provide any additional data required to assist you better.

     

    Hope this helps. Please reach out for further assistance.
    If this post helps, then please consider to Accept as the solution to help the other members find it more quickly and a kudos would be appreciated.

    Thank you.

    • mvinaykumar2003's avatar
      mvinaykumar2003
      Regular Visitor

      Hi v-veshwara-msft 

       

      Thank you for helping to resolve my issue. Attaching the sample report .

      All the fields comes from same table.

       

      1. Currently I am trying to enable start date and end date as two different slicers. Based on My selection with repoting period Start date and End date time never change. As the start date and End date are picking the max and min range available.

       

      I tried another option of having a single date slicer by adding calender table and use date column from the Calender table. So that between range can pick up the start and End date. It did not help, as it still pick the full range of dates.

       

      I am ok to change the approach or implement any fesable solution to resolve my secnario. Based on the selection of Reporting Period and Current_Prev_Month user date range should be populated as these slicers will connect to the Fact Dimension and populate the other visuals in the report.

       

      Appericate your support.

       

    • mvinaykumar2003's avatar
      mvinaykumar2003
      Regular Visitor
      Reporting_PeriodCurrent_Prev_MonthStart_DateEnd_Date
      YTD01/1/20255/11/2025
      MTD05/1/20255/11/2025
      LTM05/11/20245/11/2025
      Custom01/1/20215/11/2025
      YTD11/1/20254/30/2025
      MTD14/1/20254/30/2025
      LTM14/1/20244/30/2025

       

       

       

       

      Not able to attach the sample pbix file. posting the screen shots

      • v-veshwara-msft's avatar
        v-veshwara-msft
        Community Support

        Hi mvinaykumar2003 ,
        Thanks for the additional details and screenshot.

        I’ve tried this in my setup.

        When Start_Date and End_Date are treated as text, the slicers respond correctly to Reporting_Period and Current_Prev_Month selections .

        this works because Power BI treats them as categorical filters.

         

        However, when using real date types, slicers are designed to show a continuous range and won’t dynamically reduce their range based on slicer-driven logic.


        If your goal is to display the dynamic Start and End Dates:

        Use two text slicers (Start_Date and End_Date)

        If your goal is to filter other visuals based on this dynamic range:

        Please try this:

        Keep a proper Date table:

        DateTable = CALENDAR(DATE(2021,1,1), DATE(2025,12,31))
         

        Use measure like below to identify selected range:

        IsInSelectedRange =
        VAR _min = CALCULATE(
            MIN('Table'[Start_Date]),
            ALLSELECTED('Table')
        )
        VAR _max = CALCULATE(
            MAX('Table'[End_Date]),
            ALLSELECTED('Table')
        )
        RETURN
        IF(
            MAX('DateTable'[Date]) >= _min &&
            MAX('DateTable'[Date]) <= _max,
            1,
            0
        )
         

        Hope this helps. Please reach out for further assistance.
        If this post helps, then please consider to give a kudos and Accept as the solution to help the other members find it more quickly.

        Thank you.

  • v-veshwara-msft's avatar
    v-veshwara-msft
    Community Support

    Hi mvinaykumar2003 ,

    Just checking in to see if you query is resolved and if any responses were helpful. If so, kindly consider marking the helpful reply as 'Accepted Solution' to help others with similar queries. 

    Otherwise, feel free to reach out for further assistance.

    Thank you.

  • v-veshwara-msft's avatar
    v-veshwara-msft
    Community Support

    Hi mvinaykumar2003 ,

    Following up to see if your query has been resolved. If any of the responses helped, please consider marking the relevant reply as the 'Accepted Solution' to assist others with similar questions.

    If you're still facing issues, feel free to reach out.

    Thank you.

  • v-veshwara-msft's avatar
    v-veshwara-msft
    Community Support

    Hi mvinaykumar2003 ,

    We’re following up once more regarding your query. If it has been resolved, please mark the helpful reply as the Accepted Solution to assist others facing similar challenges.

    If you still need assistance, please let us know.
    Thank you.