cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
jonclay
Helper IV
Helper IV

Looking up a value from another table and showing as "Yes" if present

Hi all
I'm sure there's a relatively simple answer to this, but I can't think of it for the life of me!
My scenario is that I have two tables - one called Contacts and one called Preferences. Both tables contain the SerialID field, and the Preferences table also contains a Code field. Each SeriaIID can have upto 8 different Codes (A-H), so the SerialID could appear upto 8 times in the Preferences table e.g.

Contacts table

SerialID = 1

SerialID = 2

SerialID = 3

 

Preferences table

SerialID = 1 / Code = A

SerialID = 1 / Code = F

SerialID = 1 / Code = G

SerialID = 2 / Code = B

SerialID = 3 / Code = H

 

...and so on.

What I'd like to achieve is a new Column appearing on the Contact table visual within Power BI showing "Yes" if the SerialID and relevant Code appears in the Preferences table.

 

So, the Contact visual would look something like this:

 

jonclay_0-1654598102736.png

 

Any help that you could provide me with would be much appreciated.

Many thanks
Jon

1 ACCEPTED SOLUTION
AlB
Super User
Super User

Hi @jonclay 

1. Create a 1-to-Many relationship between Contacts[SerialID] and Preferences[SerialID]

2. Place Contacts[SerialID] in the rows of a matrix visual

3.  Place Preferences[Code] in the columns of the matrix visual

4. Place this measure in values of the visual

Measure = 
VAR aux_ = COUNT( Preferences[Code] )
RETURN
IF(aux_ >0, "Yes")

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

View solution in original post

3 REPLIES 3
AlB
Super User
Super User

Hi @jonclay 

1. Create a 1-to-Many relationship between Contacts[SerialID] and Preferences[SerialID]

2. Place Contacts[SerialID] in the rows of a matrix visual

3.  Place Preferences[Code] in the columns of the matrix visual

4. Place this measure in values of the visual

Measure = 
VAR aux_ = COUNT( Preferences[Code] )
RETURN
IF(aux_ >0, "Yes")

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

Thank you SO much, that works perfectly 🙂

tamerj1
Super User
Super User

Hi @jonclay 

Please try measure

Check =
IF ( NOT ISEMPTY ( 'Preferences' ), "Yes" )

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors