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
Sudhakar510
Helper I
Helper I

Direct Query Lookup

Hi I have two direct query's imported into PBI all good.

 

I am trying to retrieve a Value field from Table 1 to Table 2 using Common ID field column in both tables.

 

I am applying Lookupvalue but it is not allowing me to do. Please any help on this.

 

Or any other alternate.

 

Last option would be tweaking second query to reteive the value but it is very slow to execute.

 

Could you please help?

 

 

 

 

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @Sudhakar510 ;

I did a simple test. If the ID is unique among the three tables, then a one-to-one relationship can be created.

vyalanwumsft_0-1639124588319.png

The final output is shown below:

vyalanwumsft_1-1639124647123.png

If you don't want to create a relationship , you could create a measure such as:

Measure = CALCULATE(MAX('student'[StudentID]),FILTER('student',[FamilyID]=MAX('family'[FamilyID])))

vyalanwumsft_2-1639124791275.png


Best Regards,
Community Support Team_ Yalan Wu
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

4 REPLIES 4
v-yalanwu-msft
Community Support
Community Support

Hi, @Sudhakar510 ;

I did a simple test. If the ID is unique among the three tables, then a one-to-one relationship can be created.

vyalanwumsft_0-1639124588319.png

The final output is shown below:

vyalanwumsft_1-1639124647123.png

If you don't want to create a relationship , you could create a measure such as:

Measure = CALCULATE(MAX('student'[StudentID]),FILTER('student',[FamilyID]=MAX('family'[FamilyID])))

vyalanwumsft_2-1639124791275.png


Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Sudhakar510
Helper I
Helper I

Thank you for the response. I managed to tweak the Query in SQL and then brought direct query so that I can get the column.

 

I have 3 direct query's in same report but all reports will behave like independantly and not interactive to each other. reason for creating 3 querys because one single query is taking time so split into 3 different querys.

 

However, all three have common ID's with Unique and no duplicate. Can I still relate each other because it is not allowing me to relate each other.

 

 

v-yalanwu-msft
Community Support
Community Support

Hi, @Sudhakar510 ;

As the official document said, 

  • This function is not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules.

If two tables have relationship, you could try to use RELATED() function.such as:

 

Measure = SUMX(FILTER('Table',RELATED('Table (2)'[name])<>BLANK()),[amount])

 

vyalanwumsft_0-1639106023598.png

If it is not suitable, you could also use IN() or "=".

https://stackoverflow.com/questions/61342755/dax-formula-compatibility-in-directquery-powerbi-match-...

 

Or would you mind share simple file or screenshot about your problems?

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

smpa01
Community Champion
Community Champion

@Sudhakar510  can you try this  as a calculated column if Table A and Table B has relationship.

CALCULATE (
    MAXX ( 'Table B', 'Table B'[Value] ),
    'Table A'[ID] IN VALUES ( 'Table B'[ID] )
)

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

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.