Forum Discussion

vfx661's avatar
vfx661
Icon for Advocate I rankAdvocate I
2 years ago

Date range slicer to start and end date M parameters

Is it possible to use a date range slicer (a slicer of type 'between') to populate a start date parameter and an end date parameter for use in an M query?

I've tried creating a list of dates, creating a date parameter, binding a date field to that parameter, setting it to multiple values and then creating a slicer from the date field.  I was hoping it would return a list of dates, however instead it gives me an incompatibility warning.  Perhaps it cannot be done yet?

3 Replies

  • Hi vfx661 

     

    If I understood you correctly you would like to create a Parameter where you can change the date range?

     

    There could be other solutions, with this one you can change the dates in Power BI Service after the report has been published.

     

    Create a Start and End Date parameter, enter whatever value you need in both. Create filters with the new parameters on the table you would like to filter.

     

    After publishing you can go to the Settings of the model and go to the parameters section to change the date range.

     

    You can find more information here https://learn.microsoft.com/en-us/power-query/power-query-query-parameters

    Joe

    • vfx661's avatar
      vfx661
      Icon for Advocate I rankAdvocate I

      Hi Joe_Barry, thank you for the response.

      To clarify, the requirements is for a date range slicer (a slicer of type 'between') to populate the start and end date dynamic M parameter(s) in power bi desktop.  It can be one parameter (a list of dates) or two date parameters - I'm not fussed 🙂 

      I can already create two such parameters independently and hook them up to two independent slicers, however that isn't as good a user experience as having a slider choose the start and end dates.  We have a range slider in Power BI - it seems like a very clear use case, however I haven't found anything on it.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi vfx661 

         

        One column field can be bound to only one dynamic M query parameter. So a date column cannot be bound to two dynamic M date parameters. Please refer to the considerations and limiatations of the following documentation:

        Dynamic M query parameters in Power BI Desktop - Power BI | Microsoft Learn

         

        However, as it supports Multi-select, you can give this feature a try, maybe it helps.

         

        Best Regards,
        Jing
        If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!