Forum Discussion

Saye's avatar
Saye
Frequent Visitor
3 years ago

Default current Year

I have a table called Sales and Calender. 

When the year is selected from the slicer it should show the selected year values, if not should show the default current year. For example, if I select 2021, it should show us 2021. If I am not select any year from the slicer it should show me 2023 since 2023 is the current year.

3 Replies

  • That is not how slicers work. The closest way you can get to what you want is to change the slicer to either single select, or multi select and remove the select all option. If you go the multi select route, I usually enable the CTRL selection so people don't go crazy selecting and unselecting things. 

     

    If you are looking to perform this functionality in Dax, you would need to provide a sample measure and I can help you write it.

  • Saye's avatar
    Saye
    Frequent Visitor

    Thank you Anthony,
    Here is the DAX quey.

     

    Selected Year =

    IF (

        ISFILTERED (Calender[date_id].[Year]),

        YEAR(DATE(MAX(Calender[date_id].[YEAR]),1, 1)),

        YEAR(TODAY())

    )


    I use this DAX, it was wroking fine but now its not working. Here is the screenshoot.