cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mhambalek Regular Visitor
Regular Visitor

How to Create Slicer Using Name and Not ID

I have two tables - a Support Ticket table and an Customer table.  The Customer table has ID as a key and name as a column.  The Support Ticket table has ticket # as a key and Customer ID as a column.  I have a relationship between the two tables using the ID.

 

I want to have a slicer with customer names in it so I can report on that customer's support tickets.  I can't figure out how to use the customer name in order to reference the support ticket information via the ID.  I can put the support ticket ID field into the slicer and it works.  If I put the customer name into the slicer I get all the customer names in the customer table.  That's not what I want.

1 ACCEPTED SOLUTION

Accepted Solutions
mow700 Regular Visitor
Regular Visitor

Re: How to Create Slicer Using Name and Not ID

Consider adding a calculated column to your support ticket table to contain the related customer name like:

Customer Name = RELATED('CustomerTable'[Customer Name])

Then use this column in your slicer visual.

6 REPLIES 6
Super User
Super User

Re: How to Create Slicer Using Name and Not ID

Hi @mhambalek

 

Which direction is your relationship in your data?

 

I would imagine that as long as you are using the Customer Name from your Customer Table in your slicer, then when you click on a Customer Name it should work as expected.

 

If it does not are you able to provide a sample of your data?



Did I answer your question? Mark my post as a solution!

"Proud to be a Datanaut!"
v-ljerr-msft Super Contributor
Super Contributor

Re: How to Create Slicer Using Name and Not ID

Hi @mhambalek,



I have two tables - a Support Ticket table and an Customer table.  The Customer table has ID as a key and name as a column.  The Support Ticket table has ticket # as a key and Customer ID as a column.  I have a relationship between the two tables using the ID.


As long as the relationship between the Customer table and Support Ticket table is properly set, you should be able to simply use the Customer Name from your Customer Table as a slicer, and then when you select Customer Name it should work as expected.

 

Could you share a sample pbix file(with just some sample/mock data) which can reproduce the issue, so that we can help further investigate on it? You can upload it to OneDrive or Dropbox and post the link here. Do mask sensitive data before uploading.Smiley Happy

 

Regards

mhambalek Regular Visitor
Regular Visitor

Re: How to Create Slicer Using Name and Not ID

Hi @GilbertQ,

 

The relationship is working.  Clicking a customer that exists in the tickets table selects the right data.  The problem is the slicer shows ALL customers in the customer table and not just the ones that exist in the tickets table.  There are over 4000 customers showing in the slicer.  I'd like it to only show the ~80 customers that actually have tickets.

 

The relationship is many to one, Support Tickets to Customer and single direction.

 

Super User
Super User

Re: How to Create Slicer Using Name and Not ID

Hi @mhambalek

 

You could then use this blog post I did, in which I demonstrate how to only create a calculated table that has got the values in your data. Which is what I think you are looking for.

 

https://www.fourmoo.com/2017/01/24/power-bi-how-to-filter-slicers-dynamically/



Did I answer your question? Mark my post as a solution!

"Proud to be a Datanaut!"
mow700 Regular Visitor
Regular Visitor

Re: How to Create Slicer Using Name and Not ID

Consider adding a calculated column to your support ticket table to contain the related customer name like:

Customer Name = RELATED('CustomerTable'[Customer Name])

Then use this column in your slicer visual.

mhambalek Regular Visitor
Regular Visitor

Re: How to Create Slicer Using Name and Not ID

Thanks @mow700.  Just what I needed.

 

@GilbertQ, that actually helps me with another issue I have.  Thanks.