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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Return Current or Latest if Current is not Available

Hi, 

 

I have a monthly FX table. 

Jeff_JZ_0-1670603781500.png

 

And on my fact table, I want to lookup the monthly FX. For future Delivery Date (ie. Dec 2022 and Jan 2023), I want to return the latest month (ie. Nov 2022) FX amount as shown below. 

Jeff_JZ_2-1670604180051.png

Please help. 

 

Thank you,

Jeff

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Write this calculated column formula in Table 2

FX for calc. = lookupvalue('Table 1'[Fx],'Table 1'[Calendar]Date],calculate(max('Table 1'[Calendar Date]),filter('Table 1','Table 1'[Calendar Date]<=earlier('Table 2'[Delivery Date])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Write this calculated column formula in Table 2

FX for calc. = lookupvalue('Table 1'[Fx],'Table 1'[Calendar]Date],calculate(max('Table 1'[Calendar Date]),filter('Table 1','Table 1'[Calendar Date]<=earlier('Table 2'[Delivery Date])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
FreemanZ
Super User
Super User

supposing the two tables are related, try add a column like

FX =

IF(

    [Date]<=TODAY(), RELATED(Table1[CalendarDate]),

    CALCULATE(

        MIN(Table2[FX]), Table2[DeliveryDate]=MAX(Table1[CalendarDate])

)

)

 

Anonymous
Not applicable

Thank you @FreemanZ for your replay. It does not work as expected. 

 

Due to other reasons, two tables are not linked and today() may cause other issue in the future. I slightly twisted your sugguestion a bit. 
FX=

IF(
    Table2[Delivery Date] <= max (Table1[Calendar Date]),
    LOOKUPVALUE(Table1[FX], Table1[Calendar Date], Table2[Delivery Date]),
    CALCULATE( MIN(Table1[FX]), Table2[Delivery Date] = MAX(Table1[Calendar Date]))
)
 
The IF's 3rd argument returns the 1st (earliest) row on Table1, which is 1.3319 in my example. 
 
Regards,
Jeff

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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
Top Kudoed Authors