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
bklyn3
Advocate II
Advocate II

Reading a value from another table between dates ?

Hello

I am strugling with the following :

I have a table 1 with following info :

QuantityOrderFRom DateTo Date
1212401/01/2202/04/22
3212402/04/224/5/22
451244/5/2212/2/22



and a second table with a column order and a column date
How do I add a column in the second table with the value "Quantity" based on the column date ? 

OrderDateQuantity
1243/3/2232
1247/1/2245



2 ACCEPTED SOLUTIONS
CNENFRNL
Community Champion
Community Champion

CNENFRNL_0-1670056044459.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1670056221356.png

 

 

Quantity CC =
MAXX (
    FILTER (
        Table1,
        Table1[Order] = EARLIER ( Table2[Order] )
            && Table1[From Date] <= EARLIER ( Table2[Date] )
            && Table1[To Date] > EARLIER ( Table2[Date] )
    ),
    Table1[Quantity]
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1670056221356.png

 

 

Quantity CC =
MAXX (
    FILTER (
        Table1,
        Table1[Order] = EARLIER ( Table2[Order] )
            && Table1[From Date] <= EARLIER ( Table2[Date] )
            && Table1[To Date] > EARLIER ( Table2[Date] )
    ),
    Table1[Quantity]
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


CNENFRNL
Community Champion
Community Champion

CNENFRNL_0-1670056044459.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

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.

Top Solution Authors