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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Dax function referencing another linked table

Hi Experts,

 

I have 2 tables, Table 1 and Table 2 with ID field used to link both tables. I will like to create a column in table 1 that outputs "1" if a column in Table 2 equals to a specific value if not then "0".

 

I am having issues using an if statement that references another table to filter out a value. Any help will be much appreciated.

 

Thank you 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

I have created a data sample:

Eyelyn9_0-1650962117950.png

Let's assume "Power BI" is the specific value, please try:

New = 
var _t=SUMMARIZE(FILTER('Table 2',[ID]=EARLIER('Table 1'[ID])),[Value])
RETURN IF("Power BI" IN _t,1,0)

Or use 

New 2 = 
var _t=SUMMARIZE( FILTER('Table 2',RELATED('Table 1'[ID]) && [Value]="Power BI"),[ID])
return IF([ID] in _t,1,0)

Output:

Eyelyn9_3-1650963083165.png

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

 

I have created a data sample:

Eyelyn9_0-1650962117950.png

Let's assume "Power BI" is the specific value, please try:

New = 
var _t=SUMMARIZE(FILTER('Table 2',[ID]=EARLIER('Table 1'[ID])),[Value])
RETURN IF("Power BI" IN _t,1,0)

Or use 

New 2 = 
var _t=SUMMARIZE( FILTER('Table 2',RELATED('Table 1'[ID]) && [Value]="Power BI"),[ID])
return IF([ID] in _t,1,0)

Output:

Eyelyn9_3-1650963083165.png

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

danextian
Super User
Super User

Hi @Anonymous ,
By linked do you mean that there is an existing relationship between the two tables? On the one side of the relationship, you can use RELATED function in your formula. For example

FORMULA =
IF ( RELATED ( Table2[id] ) = "this value", 0, 1 )




Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
Anonymous
Not applicable

Hi @danextian 
Table 2 column name does seems to appear. Yes by linked i mean there is an existing relationship (one to many) both direction

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.