Forum Discussion
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
- IdrissshatilaSuper User
Hello Velafyko ,
yes, implement field parameters, check it out https://learn.microsoft.com/en-us/power-bi/create-reports/power-bi-field-parameters
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍
Follow me on Linkedin
Vote for my Community Mobile App Idea đź’ˇ- VelafykoFrequent 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)
}
- VelafykoFrequent 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.
- VelafykoFrequent Visitor
It looks like field parameters are just a calculated table. So it can not be changed based on selections.
- IdrissshatilaSuper User
Velafyko , it has her own slicer created based on the field and you can select from.
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍
Follow me on Linkedin
Vote for my Community Mobile App Idea đź’ˇ