Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Dynamically set slicers Value

Hello Team, 

Hi Friends

I have a simple requrement of dynamically loading current year value.

So I have a Year table from which my slicer take current Yr value.

Let say I saved and upload my report with the Year 2020 , now I am in Jan-2021 and I want my report to be open in 2021 Year value default. 

Please provide some solution for this.

 

Thanks for your help.

v-yuta-msft 

@FruitandVeg

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous ,

    I created a sample pbix file for you, please check whether that is what you want.

    1. Connect to the excel file

    2. Create a custom column in Power Query Editor

    let
        Source = Excel.Workbook(File.Contents("D:\data\sales.xlsx"), null, true),
        Table1_Table = Source{[Item="Table1",Kind="Table"]}[Data],
         #"Added Custom" = Table.AddColumn(Table1_Table, "Custom", each if [Year]=List.Max(Table1_Table[Year]) then "Default" else [Year])
    in
        #"Added Custom"

    3. Create a slicer with new custom column and select the option "Default"

    Best Regards

5 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks Anonymous for your response. 

      In my case requirement is simple.  I have simple Date table where "flag" is updated based on some user input which is once in Year. Once my flag is set to 1 i want my report to be open dynamically in 2021 ( which is saved and deployed as 2020 last year) , simple ...I dont have any month or other column

      Year     Flag

      2019     1

      2020     1

      2021     0

      Desired result 

      Year     Flag

      2019     1

      2020     1

      2021     1 - along with when open the report it should open in 2021

       

       

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Anonymous ,

        Whether your report exist the data from year 2021? And how does 2021 input by the user? By slicer, filter or other method? Could you please provide some sample data and your expected result with specific examples? Thank you.

        Dynamically Filter By Today's Date

        Best Regards