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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Indiandotnet
Regular Visitor

Measures for un related table

111.png

 

I have two tables 

1. Exchanage Rate  (Contains Exchange rate of each quarter from Base currency USD)

2. Sales Detail  (Contains sales detail in Local currency and may contain dates which are not in the exchange  rate table)

Apart from this I have a Currency Dropdown on  page.

My challange is by changing the currency I need to show the sales amount in specific selected currency.

For which I have to pick exchanage rate according to sales date. Here the twist is sales date might be possible not present in Exchange Rate table. so in such situation i have to pick  latest exchange rate after sales date.

I appreciate your valuable inputs to create a measure.

1 ACCEPTED SOLUTION
v-xicai
Community Support
Community Support

Hi @Indiandotnet ,

 

You may create measure like DAX below.

 

Matched Exchange Rate= MAXX(TOPN(1,FILTER('Exchange Rate Table', 'Exchange Rate Table'[Date]<=MAX('Sales Detail'[Sales Date])),'Exchange Rate Table'[Date], DESC),'Exchange Rate Table'[Exchange Rate])

Best Regards,

Amy

 

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

6 REPLIES 6
v-xicai
Community Support
Community Support

Hi  @Indiandotnet ,

 

Does that make sense? If so, kindly mark the proper reply as a solution to help others having the similar issue and close the case. If not, let me know and I'll try to help you further.

 

Best regards

Amy

v-xicai
Community Support
Community Support

Hi @Indiandotnet ,

 

You may create measure like DAX below.

 

Matched Exchange Rate= MAXX(TOPN(1,FILTER('Exchange Rate Table', 'Exchange Rate Table'[Date]<=MAX('Sales Detail'[Sales Date])),'Exchange Rate Table'[Date], DESC),'Exchange Rate Table'[Exchange Rate])

Best Regards,

Amy

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Mariusz
Community Champion
Community Champion

Hi @Indiandotnet 

 

You can add the below as a column to yor Sales table and hide the Rate table 

Column = 
VAR _Currency = TREATAS( { Sales[Base Currency] }, Rate[Currency] ) 
VAR _SalesDate = Sales[Sales Date]
RETURN 
CALCULATE( 
    MAX( Rate[Exchange Rate] ),
    _Currency,
    Rate[Date] <= _SalesDate
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

Actually I don't need calculated column. I need measure only because the value will change as per the selection of  currency dropdown.

Greg_Deckler
Community Champion
Community Champion

Perhaps something like:

 

Measure =
VAR __salesDate = MAX([Sales Date])
VAR __amount = MAX([Amount])
VAR __exchangeDate = MAXX(FILTER('Exchange Rates',[Exchang Rate] <= __salesDate),[Date]) // assumes exchange rate table filtered by slicer
RETURN
MAXX(FILTER('Exchange Rates',[Date] = __exchangeDate),[Exchange Rate])

Several assumptions made in there.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thanks for the reply.

But it will not resolve the problem.

I need the exchange rate again each sales date. Now , the issue is there is no direct relationship between Exchange Rate table and Sales table. As Sales table may contain Dates which are not exists in Exchange Rate table.

Here is the logic

1. If Exchange Date of Exchange rate and sales date of sales table match then pic the exchange rate  of that particular row .

2. If exchange rate not exists for sales date then pic exchange rate of exchange date just below the sales date.

 

I hope it is more clear.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.