Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

select largest value automatically slicer

How can I make a slicer that it can select largest value automatically when data source related column changes?
for example, the data column is 202203,202204,202205, now I make it 202205 by default, how to make it changed when data added 202206?
and I also need to ensure other values like 202203 202204 that still can I selected

Do you have any ideas?

3 Replies

  • dbulawa's avatar
    dbulawa
    Frequent Visitor

    If you are using a dropdown/tile/list slicer to select your date you can do the following:

     

    • Go to the right-hand Data pane and click the "..." (More Options) of the database containing your date values
    • Create a "New Column"
    • Enter the following formula for the new column:

     

    Date_Slicer = if([NameOfYourDateColumn] = MAX([NameOfYourDateColumn]), "Latest Month", FORMAT([NameOfYourDateColumn], "MM-YYYY"))

     

    • Select the "Table view" on the left-hand side, select the "Column tools" tab and select your original date column in "Sort by column":

    • Instead of the date column, use this new column for your slicer
    • Ensure that "Latest Month" is selected before publishing:

     

    As you can see this is written for a date column as a source, but it should also work for other value types (just leave out the FORMAT part then).

  • Hey Anonymous ,

     

    unfortunately this is not possible. The reason for this is that a slicer has not property "default value" where you can add a measure that determines the value to determine the value that should be seleceted by default, e.g. the current day, the max value etc. 

    There are some approaches that filter the values visible in the slicer. But all of these slicers come with a downside like requiring another slicer with members like ALL and Today. The selection then will control the measure that filters the available members in the base slicer. You have to be aware that these approaches do not filter they only hide or unhide what's visible in the slicer.

    Another approach is to create a second table like so
    Slicer | Value

    MAX | 3

    ALL | 1

    ALL | 2

    ALL | 3

    Then you can create a relation between the value column and the dimension table, this relationship then has the cross filter property set to BOTH, this of course will only work if the value for MAX is not dependent from other selections as the content of this table will only be updated during data refresh.

     

    Maybe you can upvote an existing idea on ideas.powerbi.com or create a new idea.

     

    Regards,

    Tom