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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Lookup Value from another table based on first date

Hello Community, 

 

I am trying to lookup a value in a child table based on the first delivery date. The tricky part of this is that there will be multiple delivery numbers for each distinct value in the parent table. From the parent table, I want to retrieve the first order number from the child table based on the first delivery date. 

 

This is what I am building (Parent):

Order Shipping Point IDFirst Delivery Number (NEED)
7685590 | 39151111
7686263 | 39SP2221

 

This is what I have (Child): --- Highlighted in red is the row I am needing

Order Shipping point IDDelivery NumberDelivery Date
7685590 | 3915

1111

1/1/2021
7685590 | 391511121/3/2021
7685590 | 391511131/5/2021
7686263 | 39SP22211/2/2021
7686263 | 39SP22221/4/2021
2 ACCEPTED SOLUTIONS
mahoneypat
Microsoft Employee
Microsoft Employee

Please try this measure expression, replace Child for your actual child table name.

 

First Delivery Number = FIRSTNONBLANKVALUE(Child[Delivery Date], MIN(Child[Deliver Number]))

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

mahoneypat
Microsoft Employee
Microsoft Employee

What I provided was a measure expression.  To use it in a column, wrap the whole expression in CALCULATE( ).

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

5 REPLIES 5
mahoneypat
Microsoft Employee
Microsoft Employee

What I provided was a measure expression.  To use it in a column, wrap the whole expression in CALCULATE( ).

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

@mahoneypat 
That was the trick, thank you, that works perfectly!

 

I did come up with an alternative solultion by using this code and just filter on 1 for any calculation

Josh97Ellis_0-1610065995391.png

 

Anonymous
Not applicable

@mahoneypat 

 

Josh97Ellis_1-1610062157872.png

 

The green column (Excel) is the field I am refering to from the parent table (PBI).

 

I want to lookup the delivery number (blue) for only the first delivery created date (Orange) based on the Order shipping point ID (Green).

 

Lookup in PowerBi should be: 

 
Order shipping pointFirst Delivery 
7686639 | 391553190034
7686339 | 39SP53191851

 

 

mahoneypat
Microsoft Employee
Microsoft Employee

Please try this measure expression, replace Child for your actual child table name.

 

First Delivery Number = FIRSTNONBLANKVALUE(Child[Delivery Date], MIN(Child[Deliver Number]))

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

@mahoneypat 

Doing this as a calculated column, I get a delivery nyumber from the child table. However, the delivery number that is being populated is not correct and is not even part of the corresponding order number

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.

Top Solution Authors