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
Anonymous
Not applicable

How to get value from another table based on condition and specific period

Hello,

 

I'm in stuck with my problem. Let's say I have 2 tables: Quotes and Shipments. My goal is to transfer QuoteID from Quotes table into Shipments table if such conditions are met:

 

Condintion = Condition

Departure is between StartDate and ExpiryDate

 

please see my file via this link

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

You could try this:

Quote ID =
CALCULATE (
    FIRSTNONBLANK ( Quotes[Quote ID], 1 ),
    FILTER (
        Quotes,
        Quotes[Condition] = EARLIER ( Shipments[Condition] )
            && EARLIER ( Shipments[Departure] ) >= Quotes[StartDate]
            && EARLIER ( Shipments[Departure] ) <= Quotes[ExpiryDate]
    )
)

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
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

3 REPLIES 3
shairad
Regular Visitor

Thank you @v-yulgu-msft this works great

v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

You could try this:

Quote ID =
CALCULATE (
    FIRSTNONBLANK ( Quotes[Quote ID], 1 ),
    FILTER (
        Quotes,
        Quotes[Condition] = EARLIER ( Shipments[Condition] )
            && EARLIER ( Shipments[Departure] ) >= Quotes[StartDate]
            && EARLIER ( Shipments[Departure] ) <= Quotes[ExpiryDate]
    )
)

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thank you, @v-yulgu-msft, it worked as expected!

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.