cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bklyn3
Frequent Visitor

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
Super User
Super User

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
Super User
Super User

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
May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Submit your Data Story

Data Stories Gallery

Share your Data Story with the Community in the Data Stories Gallery.

Top Solution Authors
Top Kudoed Authors