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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
tinye
Regular Visitor

How can I create custom column to bring in a value (lookup) from another table with conditions

Table 1

 

index

0

3

7

 

Table 2

0

1

2

3

4

5

6

7

 

What I want is to add a new column in table 2, I will use the first equal value in Table 1 for next rows until new value match.

here is my expectation:

Table 2

index    new column

0             0  (first matching in table 1)

1             0

2             0

3             3  (first matching in table 1)

4             3

5             3

6             3

7             7  (first matching in table 1)

 

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@tinye 

Add the following new column in Table two:

New Col = 
CALCULATE(
    MAX(Table1[Index]),
    Table1[Index] <= EARLIER(Table2[Value])
)

Fowmy_0-1666862629425.png

 



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

1 REPLY 1
Fowmy
Super User
Super User

@tinye 

Add the following new column in Table two:

New Col = 
CALCULATE(
    MAX(Table1[Index]),
    Table1[Index] <= EARLIER(Table2[Value])
)

Fowmy_0-1666862629425.png

 



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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