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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
MilanAXVII
Helper I
Helper I

Using Data from One Table in Another Table

hi everyone,

 

I'm new on Power BI, and i have a pb on Power BI Desktop.

 

I have two tables and i want to link them. and I want a link from table_1 to table_2 and from table_2 to table_1

I need this link because i want to take cells of table_2 to put it in table_1 (like a vlookup in excel)

 

But there is not the same count of rows in the two tables. 

 

for example i want create the red columnpower help 2.PNG

Thanks for your help. 🙂

 

 

 

1 ACCEPTED SOLUTION

@MilanAXVII

 

Time in Table1 =
VAR myresult =
    CALCULATE (
        FIRSTNONBLANK ( Table2[time], 1 ),
        FILTER ( Table2, Table2[id] = Table1[id] )
    )
RETURN
    IF ( ISBLANK ( myresult ), 0, myresult )

Regards
Zubair

Please try my custom visuals

View solution in original post

5 REPLIES 5
jthomson
Solution Sage
Solution Sage

In table 2 you've got multiple rows for id, albeit with the same time - if it's always going to be the same time, just remove the duplicates in table 2 and you can then relate the two tables, if not, how is Power BI going to know which row to look up?

hi

thanks for your answer.

i need to keep all rows in table_2 because there are also different data in other columns

If there is a posibility to take the first value each time it will be the good thing for me. but i dont know if it is possible.

@MilanAXVII

 

Time in Table1 =
VAR myresult =
    CALCULATE (
        FIRSTNONBLANK ( Table2[time], 1 ),
        FILTER ( Table2, Table2[id] = Table1[id] )
    )
RETURN
    IF ( ISBLANK ( myresult ), 0, myresult )

Regards
Zubair

Please try my custom visuals

thanks again @Zubair_Muhammad, it's working

@MilanAXVII,

 

By the way, you may help accept solution. Your contribution is highly appreciated.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.