Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi Everyone,
I wanted to create a slicer based on column name
I have created a visual based on two column 2021 and 2022 data, but I want a slicer name "2021" and "2022"
And when I click on 2021, it show visual values of 2021 Light Blue one and same for 2022 Dark Blue one
And If I don't click on anyone of slicer it shows the following
Thank you
Solved! Go to Solution.
@Anonymous
There are two methods.
First one which I recommend is to edit the code of the table in a way that makes it unpivoted.
The 2nd solution is to create a new unpivoted calculated table using dax (refer to following code). However, this code shall provide an idea on how to edit the code of the original table
NewTable =
UNION (
SELECTCOLUMNS (
OldTable,
"Category", OldTable[Category],
"Year", 2021,
"Total", OldTable[Total 2021]
),
SELECTCOLUMNS (
OldTable,
"Category", OldTable[Category],
"Year", 2022,
"Total", OldTable[Total 2022]
)
)
@Anonymous
There are two methods.
First one which I recommend is to edit the code of the table in a way that makes it unpivoted.
The 2nd solution is to create a new unpivoted calculated table using dax (refer to following code). However, this code shall provide an idea on how to edit the code of the original table
NewTable =
UNION (
SELECTCOLUMNS (
OldTable,
"Category", OldTable[Category],
"Year", 2021,
"Total", OldTable[Total 2021]
),
SELECTCOLUMNS (
OldTable,
"Category", OldTable[Category],
"Year", 2022,
"Total", OldTable[Total 2022]
)
)
Hi @Anonymous
you need first to unpivot the two columns using power query. The column names will become values of the Attributes column then you can use it for slicing
Hi @tamerj1 ,
I have created this table based on other tables values, I can't take this table to Edit Query mode
If there is a way, then kindly guide me
Thank you
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
9 | |
8 | |
8 | |
8 |
User | Count |
---|---|
13 | |
12 | |
11 | |
10 | |
9 |