The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi Power BI Community - can anyone help me with the measure that I need to write to accomplish this? I am really striking out on this and need help. I have 2 tables; Table A - exchange rate table with rates posted at the end of each month, and table B - invoice table with dates, amounts in local currency and currency type. I need a measure that will compare the invoice_date and currency_ID to the exchange rate table and bring back the correct rate. The exchange rates are posted at the end of the month so that the 7/31/2020 exchange rate is applied to invoices during the month of July.
Solved! Go to Solution.
Assuming VALID_UNTIL and CURRENCYFROM_ID are a composite key for Table A, you could add a calculated column to both tables and relate them that way to then pull over corresponding exchange rate. Calculated column DAX would look like:
'Table A'[ExId] =
VAR _dt = 'Table A'[VALID_UNTIL]
VAR _exId = 'Table A'[CURRENCYFROM_ID]
RETURN
_exId * 10^8
+ YEAR( _dt ) * 10^4
+ MONTH( _dt ) * 10^2
+ DAY( _dt )
'Table B'[ExId] =
VAR _dt = EOMONTH( 'Table B'[invoice_date], 0 )
VAR _exId = 'Table B'[Currency_ID]
RETURN
_exId * 10^8
+ YEAR( _dt ) * 10^4
+ MONTH( _dt ) * 10^2
+ DAY( _dt )
Assuming VALID_UNTIL and CURRENCYFROM_ID are a composite key for Table A, you could add a calculated column to both tables and relate them that way to then pull over corresponding exchange rate. Calculated column DAX would look like:
'Table A'[ExId] =
VAR _dt = 'Table A'[VALID_UNTIL]
VAR _exId = 'Table A'[CURRENCYFROM_ID]
RETURN
_exId * 10^8
+ YEAR( _dt ) * 10^4
+ MONTH( _dt ) * 10^2
+ DAY( _dt )
'Table B'[ExId] =
VAR _dt = EOMONTH( 'Table B'[invoice_date], 0 )
VAR _exId = 'Table B'[Currency_ID]
RETURN
_exId * 10^8
+ YEAR( _dt ) * 10^4
+ MONTH( _dt ) * 10^2
+ DAY( _dt )
Thank you - this was very helpful!
Thanks - I will try it.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
81 | |
72 | |
49 | |
41 |
User | Count |
---|---|
139 | |
119 | |
74 | |
64 | |
63 |