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 repo...
  • 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