Forum Discussion

tina345's avatar
tina345
Icon for Helper II rankHelper II
1 year ago
Solved

How to default 'Year_Month_Code' to pick the latest value when we load report

Hello,

   I don't see any option to pick default value on a slicer.

   

  I have a table which has different year_month_code values and when I launch power bi report, it picks any random value and loads the report.

 

    Is there a way on power BI to use latest 'year_month_value' that my table has to be default value when launching the report link?

   So everytime when I click report link, it displays latest one?

 

    Thanks 

  • Hi tina345  As I can understand that you want to pick latest year-month value as default value on slicer. You can try this method to acheive this:

     

    Lastly sort Month-Year by Month-YearSortIndex:

     

    Now you can create a slicer with month-year by single select.

     

    Or, you can create a measure and use in the visual label filter. 

    LatestYearMonthCode = IF(MAX('CalendarTable'[Month])=MONTH(TODAY()) && MAX(CalendarTable[Year]) = YEAR(TODAY()), 1, 0)

     

    Hope this helps!!

    If this solved your problem, please accept it as a solution!!

     

    Best Regards,
    Shahariar Hafiz

2 Replies

  • Hi tina345 

     

    Please refer to this video. There's a downlodable sample file in the video description.

    https://www.youtube.com/watch?v=MrEAZREQuXM 

     

    Please note that if persistent filter is enabled in the service, the slicer selection will default to the user's saved slicer selections.

  • Hi tina345  As I can understand that you want to pick latest year-month value as default value on slicer. You can try this method to acheive this:

     

    Lastly sort Month-Year by Month-YearSortIndex:

     

    Now you can create a slicer with month-year by single select.

     

    Or, you can create a measure and use in the visual label filter. 

    LatestYearMonthCode = IF(MAX('CalendarTable'[Month])=MONTH(TODAY()) && MAX(CalendarTable[Year]) = YEAR(TODAY()), 1, 0)

     

    Hope this helps!!

    If this solved your problem, please accept it as a solution!!

     

    Best Regards,
    Shahariar Hafiz