Forum Discussion

Akshata_10's avatar
Akshata_10
Regular Visitor
2 years ago
Solved

Need Help with Creating a Dynamic Slicer in Power BI

Hello,


I'm looking to create a dynamic slicer in Power BI that updates automatically every month and allows users to filter past months as well. Currently, we are manually updating a bookmark each month, but we want to automate this process.
Key requirements

The slicer should update to the current month automatically. Users should be able to filter past months if needed.
We want to eliminate manual updates, possibly through DAX measures or other dynamic techniques.
Could someone guide me step-by-step on how to achieve this in Power BI? Any insights or examples would be greatly appreciated.


Thank you!

  • ajohnso2's avatar
    ajohnso2
    2 years ago

    Hi,

    I created the custom column in power query, all of the rolling time categories are available in my date dimension, all of these rolling categories are updated daily in my warehouse.

     

    You could do something very rudimental such as:

     

4 Replies

  • ajohnso2's avatar
    ajohnso2
    Solution Supplier

    Consider your Date table if you have rolling integer columns identifying your months you could create a new column in your table.

    The date table:

    Month            Rolling Month Number

    Jan                  -5    

    Feb                 -4

    March             -3

    April                -2

    May                -1

    June                0

    July                 1

    Aug                2

    so on...

     

    Custom column would do something such as

    If(Rolling Month Number = 0, "Reporting Month", Month)

     

    You can deploy your report with Reporting Month selected (on your slicer), the report will always filter to the current month. (Assuming you have integer columns - these would need to be updated daily)

     

    Your slicer could end up looking something like this.

     

    • Akshata_10's avatar
      Akshata_10
      Regular Visitor

      Hi John,

      Thank you for your solution.

      I'm currently using the following calculation for Rolling Month Number:


      Rolling Month Number =
      VAR CurrentDate = MIN('Date'[Refresh_Date])
      VAR CurrentMonth = MONTH(CurrentDate)
      VAR CurrentYear = YEAR(CurrentDate)
      VAR DateMonth = MONTH('Date'[Refresh_Date])
      VAR DateYear = YEAR('Date'[Refresh_Date])
      RETURN
      (CurrentYear - DateYear) * 12 + CurrentMonth - DateMonth


      Could you please guide me on how to proceed with creating the custom column based on this calculation? Also, I'm unclear about how the filtering process would function using the "Reporting Month" approach you mentioned. Could you elaborate on that as well?

      Thanks again for your assistance.

      Regards,

      Akshata

      • ajohnso2's avatar
        ajohnso2
        Solution Supplier

        Hi,

        I created the custom column in power query, all of the rolling time categories are available in my date dimension, all of these rolling categories are updated daily in my warehouse.

         

        You could do something very rudimental such as: