cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mikail
Frequent Visitor

Retrieve Multiple Columns From Another Table

Hello Power BI community,

I hope everyone doing well. Currently I am working on a table which I need to add couple of columns from another table. I managed to retrieve one column based on filter context however I would like to learn if there is a way to retrieve multiple columns at the same time. Thanks to this community I found following DAX code which retrieves one column based on one or multiple filter context. The code below return students age, but I would like to retrieve grades, parent name etc. at the same time. 

 

Student Age =
CALCULATE (
FIRSTNONBLANK ('Student[Age], 1),
FILTER (
'Student',
'School[Student Number] = 'Student'[ID]
)
)
1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi  @Mikail ,

 

You could use lookupvalue function to realize it.

Syntax:

 

LOOKUPVALUE(
    <result_columnName>,
    <search_columnName>,
    <search_value>
    [, <search2_columnName>, <search2_value>]…
    [, <alternateResult>]
)

 

Check here for more details.

Also check below blog for reference:

https://www.c-sharpcorner.com/article/dax-in-power-bi-how-to-use-lookupvalue-function/

 

Best Regards,
Kelly

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

View solution in original post

4 REPLIES 4
v-kelly-msft
Community Support
Community Support

Hi  @Mikail ,

 

You could use lookupvalue function to realize it.

Syntax:

 

LOOKUPVALUE(
    <result_columnName>,
    <search_columnName>,
    <search_value>
    [, <search2_columnName>, <search2_value>]…
    [, <alternateResult>]
)

 

Check here for more details.

Also check below blog for reference:

https://www.c-sharpcorner.com/article/dax-in-power-bi-how-to-use-lookupvalue-function/

 

Best Regards,
Kelly

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

Thank you! Missed that functionality of Lookupvalue(). 

amitchandak
Super User
Super User

@Mikail , In this case, better option is to merge in power query

Merge Tables (Power Query) : https://www.youtube.com/watch?v=zNrmbagO0Oo&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=16

https://radacad.com/append-vs-merge-in-power-bi-and-power-query

 

Or you need two create new columns for all those required columns.

 

If DAX we prefer dimensions to remain separate. So unless it is most required, you should avoid it.

 



New Power BI Features
Datamarts: https://youtu.be/8tskWsJTEpg
Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin !! Proud to be a Super User!
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
!! Subscribe to my youtube Channel !!

Hello thanks a lot for your reply. However as the number of rows differ merge operation is not working. Only option seems to retrieve each column one by one for now. 

Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors