Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Power bi Service

Hi Power bi Team,

When we refreshing in Power bi  in service , Month should automatically selected latest month in the Slicer. When Some one visite the power bi service click on Link latest month automatically selected in Slicer.

  • Hi Anonymous 

    To auto-select the latest month in a slicer in Power BI Service:

    1. Add a Column: Create a calculated column in your date table.

     

    IsLatestMonth = IF(FORMAT('Date'[Date], "YYYY-MM") = FORMAT(TODAY(), "YYYY-MM"), 1, 0)

     

    • Set a Slicer: Use the "Month" field in a slicer and enable Single Select.

    • Apply Filter: Add a visual-level filter to the slicer: IsLatestMonth = 1.

    • Publish: Save and publish the report. After refresh, the slicer will auto-select the latest month.

     

    Did I answer your question? Mark my post as a solution, this will help others!

    If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

    Kind Regards,
    Poojara
    Data Analyst | MSBI Developer | Power BI Consultant
    Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS 

9 Replies

  • Hi Anonymous 

    To auto-select the latest month in a slicer in Power BI Service:

    1. Add a Column: Create a calculated column in your date table.

     

    IsLatestMonth = IF(FORMAT('Date'[Date], "YYYY-MM") = FORMAT(TODAY(), "YYYY-MM"), 1, 0)

     

    • Set a Slicer: Use the "Month" field in a slicer and enable Single Select.

    • Apply Filter: Add a visual-level filter to the slicer: IsLatestMonth = 1.

    • Publish: Save and publish the report. After refresh, the slicer will auto-select the latest month.

     

    Did I answer your question? Mark my post as a solution, this will help others!

    If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

    Kind Regards,
    Poojara
    Data Analyst | MSBI Developer | Power BI Consultant
    Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS 

    • Anonymous's avatar
      Anonymous
      Not applicable

      User can Select the past month also when he open the drop down  but when He refreshing the link or open the link in Service , Slicer should Automatically select the Latest month . 

  • Hi Anonymous ,

    I believe your question is how can we get slicer automatically updated to latest / current month without manually changing it. 

    For that we need to add another column - for current month in DAX calendar table. And the column name will be static like Current/Latest. And the latest month will be saved in "Current"

    Calendar Table DAX

    Then Default Month / Current Dax query:

    Sort the Default Month by month number

     

    You can also refer this thread for detailed exlaination https://community.fabric.microsoft.com/t5/Desktop/How-to-make-slicer-default-showing-latest-month-as-the-selection/m-p/3167597#M1069170

    If this post helps, please accept this as a solution. Appreciate your kudos.

    Thanks,

    Pallavi

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Do you implemention  video , I have some similer requirement , I will adjust as per my requirement . 

      • pallavi_r's avatar
        pallavi_r
        Super User

        Hi Anonymous ,

        I don't have implementation video, but this is exactly how I have coded in my implementation.

        1. I have a year and month slicer, where I want the slicer to pick latest month and latest year as default.

        2. I have created calendar dax table with below script

        ---------

        Calendar Date =

        ADDCOLUMNS (

        CALENDAR (DATE(year(NOW())-2,1,1),Today()),

        "MonthNameShort", UPPER(FORMAT ( [Date], "MMM" )),

        "Monthnumber", FORMAT ( [Date], "MM" ),

        "Quarter", "Q" & FORMAT ( [Date], "Q" ),

        "Year", YEAR ( [Date] ),

        "DateID", FORMAT ( [Date], "YYYYMMDD" ),

        "YearMonth",Format ([Date],"YYYYMM"))
        ------------------------------------------
        3. Then I have created 2 columns in calendar table fo default year and month

        Month Default

        Month - Default =
        var currentMonth = UPPER(FORMAT ( NOW(), "MMM" ))
        var month = 'Calendar Date'[MonthNameShort]
        return if(currentMonth=month,"Current",month)
         
        Year Default:
        Year - Default =
        var currentYear = FORMAT ( NOW(), "YYYY" )
        var year = FORMAT('Calendar Date'[Date],"YYYY")
        return if(currentYear=year,"Current",year)
        4. Then sort the month-default as per month no.

         

        This is the complete end to end implementation. 

         

        If this post helps, please accept this as a solution. Appreciate your kudos.
         

         

        Thanks,

        Pallavi

  • v-prasare's avatar
    v-prasare
    Community Support

    Hi Anonymous , As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by our community members helps you? or let us know if you need any further assistance here? 

     

    Your feedback is important to us, Looking forward to your response.

     

    Thanks,

    Prashanth Are

    MS Fabric community support.

     

    Did I answer your question? Mark my post as a solution, this will help others!

    If my response(s) assisted you in any way, don't forget to drop me a "Kudos"

  • v-prasare's avatar
    v-prasare
    Community Support

    Anonymous,

    As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by our community members helps you? or let us know if you need any further assistance here? 

     

    Your feedback is important to us, Looking forward to your response.

     

    Thanks,

    Prashanth Are

    MS Fabric community support.

     

    Did I answer your question? Mark my post as a solution, this will help others!

    If my response(s) assisted you in any way, don't forget to drop me a "Kudos"

  • v-prasare's avatar
    v-prasare
    Community Support

    Anonymous , As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by our community members helps you? or let us know if you need any further assistance here? 

     

    Your feedback is important to us, Looking forward to your response.

     

    Thanks,

    Prashanth Are

    MS Fabric community support.

     

    Did I answer your question? Mark my post as a solution, this will help others!

    If my response(s) assisted you in any way, don't forget to drop me a "Kudos"