Forum Discussion

Velafyko's avatar
Velafyko
Frequent Visitor
2 years ago

Automatically change columns depending on slicer selection

Hi all

 

In the columns of a matrix I have a Year field. I also have a slicer where the user can select the Year.

 

When the user selects a single Year in the slicer, I would like the columns in the matrix to be replaced by Months instead of Year.

 

Is it possible to do this?

5 Replies

    • Velafyko's avatar
      Velafyko
      Frequent Visitor

      I created a field parameter, and edited its DAX. But it does not work. Any idea what is wrong? I get no error message, but the matrix always shows the year column, never month.
      AutoMonth=
      {
      (if (HASONEVALUE(Date[Year])=true,"Month", "Year"),
      if (HASONEVALUE(Date[Year])=true,NAMEOF('Date'[Month]), NAMEOF('Date'[Year])),
      0)
      }

  • Velafyko's avatar
    Velafyko
    Frequent Visitor

    Thank you, Idrissshatila. But I don't think field parameters are what I'm looking for. As I understand them, with field parameters you could have a slicer with the values "Year" and "Month", and the user could select one of those.

     

    However, I want a slicer with all the years as values: "2021, "2022", "2023". When just a single year is selected in this slicer, I want the column in my matrix to be months, otherwise they should be years.

  • Velafyko's avatar
    Velafyko
    Frequent Visitor

    It looks like field parameters are just a calculated table. So it can not be changed based on selections.