Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
SnowPanda
New Member

Slicer

Greetings to all. I need help, can I construct a slicer by using header instead of column? 
 
I have a table that comprise of 7 Columns, first column contains staff ID while the rest contain values accroding to the types of leave. As for now, I managed to construct the slicer based on the first column which is the Staff ID. What I want to do next is to contruct the slicer based on the types of leave. How can I do that ? Thanks in advance.

4 REPLIES 4
Sean
Community Champion
Community Champion

@SnowPanda

You have not provided any sample data - however from what you are describing it sounds like you may need to UNPIVOT the data!

This is very easily done in the Query Editor!

Look at my response here

http://community.powerbi.com/t5/Desktop/Multiple-Stacked-Bar-Charts/m-p/87492#M36659

Phil_Seamark
Microsoft Employee
Microsoft Employee

You could change your table into a 3 column table as one option

 

Col1 = StaffID

Col2 = Leave Type

Col3 = Leave Value

 

You can then easily create a slicer over Col2.

 

You can do this in your Query Editor using Append, or in DAX using the UNION.

 

Let us know which you prefer and we can give more detailed instructions.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

pBi.PNG
First of all thank you for your reply previous. This is my example of table, I want to make the header (AL, EL, ML, LC, UL, MIA) as slicer instead of the staff ID

Sean
Community Champion
Community Champion

@SnowPanda

In the Query Editor => select both Staff ID and Staff Name columns => Transform tab => Unpivot Other Columns

Rename the new Attribute and Value columns with appropriate names

(double clck on the column names or right-click and select rename)

the Home tab => Close & Apply

now you can use the Attribute (or whatever new name you have given this column) as your Slicer

 

Good Luck!Smiley Happy

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.