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
Olia
Advocate II
Advocate II

Table Relationships: show only data in both tables

Hi everyone,

 

I have 2 tables: Headcount and Country names.

 

Country names is basically a connection to this page: https://www.worldatlas.com/aatlas/ctycodes.htm, so it has Country Name and 2 letter Code

Headcount... has the 2 letter country Codes, and as you can imagine, it has many rows with the same country code. 

 

I really want to make a slicer that will show Country Names for people to select.... but when I make a slicer with Country Name variable, it shows ALL country names that are listed on the webpage. I'd like it to show ONLY the country names for which I have a code in Headcount table.

 

 

edit: I don't think that the sample-dataset provided to me contains ALL the country codes that we have. so if anotehr user has more permissions, then it'd be nice if he could see the data for the countries that is unavailble to me as the maker of the report.

 

Any suggestions?

 

 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

Well, one way would be to create a table that did something like:

 

Slicer Table = 
VAR __tmpTable = DISTINCT('Headcount'[Code])
RETURN ADDCOLUMNS(__tmpTable,"Country",LOOKUPVALUE('Country'[Country Name],'Country'[Code],'Headcount'[Code]))

Something like that.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

Well, one way would be to create a table that did something like:

 

Slicer Table = 
VAR __tmpTable = DISTINCT('Headcount'[Code])
RETURN ADDCOLUMNS(__tmpTable,"Country",LOOKUPVALUE('Country'[Country Name],'Country'[Code],'Headcount'[Code]))

Something like that.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

I'm noobing something wrong: The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.

what does this mean?

Hmm, difficult to say. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

That being said, see attached PBIX.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

I tried to make a measure instead of a table... (never made Tables before, so didn't even see that option there).

so of course that didn't work, lol.

 

Thank you very much for your help and your patience Greg!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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