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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
PNDC_MLR
New Member

Find matching values within multiple columns from different table

Hello everyone!

 

Our customer sends us a list of businesses that we provide services for. Each business has a unique CustomerID number. I'm trying to get the data from a second table where we store all the ticket data. Unfortunately the unique CustomerID could be amongst 3 different columns within the ticket data table as the CustomerID is sometimes assigned by one of our tools, so the columns in the ticket data table are 

1. Ticket_CustomerID

2. Tool1_CustomerID

3. Tool2_CustomerID

 

However, most times Ticket_CustomerID and Tool1_CustomerID are the exact same, sometimes they aren't. Sometimes neither Ticket_CustomerID nor Tool1_CustomerID match with the list of businesses CustomerID but there's a match with the Tool2_CustomerID. 

 

What I'm trying to do is to get all ticket data (all rows from the ticket table) where the CustomerID from the list of businesses is matching with either one of the 3 ticket data CustomerID columns, e.g. find matches between CustomerID and Ticket_CustomerID, if not matched, look for matches between CustomerID and Tool1_CustomerID etc. but I would also need to make sure that there are no duplicates so I would need to avoid to collect the ticket data twice if Ticket_CustomerID and Tool1_CustomerID are the same value. 

 

Tables

List of Businesses

CustomerIDBusiness NameAssigned to Employee
1234BusinessNameDEmployeeA
2234BusinessNameXEmployeeB
3234BusinessNameYEmployeeC

 

Ticket Data

TicketNumberAssigned toTicket_CustomerIDTool1_CustomerIDTool2_CustomerID
1EmployeeA12347785null
2EmployeeB223422345478
3EmployeeC6345null3234

 

There is of course more data in the ticket table, multiple tickets per business, multiple tickets per employee, contact dates, contact channels, accepted services etc. but no relevant data that could help identify the tickets that are matching the CustomerID.

 

Any help would be much appreciated!

1 ACCEPTED SOLUTION
hnguy71
Super User
Super User

Hi @PNDC_MLR ,
You're looking at a basic data model where you have one dimension and one fact table.

You should be able to achieve this by unpivoting your ticket and customer columns from your ticket data table like so:

hnguy71_0-1719880880309.png

 

Once loaded, create a relationship between your fact and dimension by the customerId column:

hnguy71_1-1719880922641.png

 

Now, all that's left is to take your customer id from your list of businesses and place it in a visual with an aggregate measure, such as count number of tickets per customer.


Here's an example:

CountOf.Tickets = DISTINCTCOUNT(TicketData[TicketNumber])

 

And sample output of the measure:

hnguy71_2-1719881297267.png

 

If this isn't the result you're looking for, please do provide a sample output for additional clarity. 



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Based on the data that you have shared, show the expected result very clearly.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

Use COALESCE.

hnguy71
Super User
Super User

Hi @PNDC_MLR ,
You're looking at a basic data model where you have one dimension and one fact table.

You should be able to achieve this by unpivoting your ticket and customer columns from your ticket data table like so:

hnguy71_0-1719880880309.png

 

Once loaded, create a relationship between your fact and dimension by the customerId column:

hnguy71_1-1719880922641.png

 

Now, all that's left is to take your customer id from your list of businesses and place it in a visual with an aggregate measure, such as count number of tickets per customer.


Here's an example:

CountOf.Tickets = DISTINCTCOUNT(TicketData[TicketNumber])

 

And sample output of the measure:

hnguy71_2-1719881297267.png

 

If this isn't the result you're looking for, please do provide a sample output for additional clarity. 



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Hi @hnguy71 thank you very much for the suggestion. 

 

I was actually able to make it work with some additional steps. Why unpivoting was also something I've thought of, I wasn't able how to handle the duplicate ticket data. What I've shown here is a very simple example of what we're actually working with, there are more dimensional tables for time and business filtering and already established measures that have shown incorrect numbers with the duplicate ticket data as we were also looking at different KPIs on employee level. 

In order to remove the duplicates I've joined the list of businesses on the new customerID column and was then able to remove duplicate ticketnumber rows while still maintining the list of tickets mapped to the customerIDs. 

 

Thank you so much!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors