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.
My rate table is constructed as such:
Currency Date Rate
USD 1/1/2020 1.33
USD 1/15/2020 1.31
USD 1/21/2020 1.28
I have a sales table with a sales date from almost every day. I need to pull the exchange rate into the sales table for every day of the year even though the exchange rate table above only contains the date the rate changed. How do I pull the exchange rate for say 1/10/2020 which of course I need 1.33?
Solved! Go to Solution.
Hi, @delsbg
Unfortunately, merge query is not supported in direct query mode, I got the same error as yours when I tested it. My opinion is that we should use as less calculated column/table as we can in direct query mode, which can affect the performance of the report. As a result, you can consider making the merge query in the data source (like Sqlserver database), or you can just switch into import mode for more data transformation functions and faster query speed
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @delsbg
According to your description, you want to pull the exchange rate into the sales table for every day of the year, I suggest you achieve it through Power query editor, you can follow my steps:
And you can get what you want, like this:
You can download my test pbix file here
If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.
How to Get Your Question Answered Quickly
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
This is a good approach thank you. Unfortunately I should have included in my original post that I need to stay in DirectQuery. Fill down seems to kick me out of DirectQuery when I merge the two based on dates. I will continue to fiddle with that approach though.
Hi, @delsbg
Unfortunately, merge query is not supported in direct query mode, I got the same error as yours when I tested it. My opinion is that we should use as less calculated column/table as we can in direct query mode, which can affect the performance of the report. As a result, you can consider making the merge query in the data source (like Sqlserver database), or you can just switch into import mode for more data transformation functions and faster query speed
Best Regards,
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Try this calculated column in the Sales table:
Exchange Rate =
VAR vCurrentDate = Sales[Date]
VAR vMaxDate =
CALCULATE ( MAX ( ExchangeRate[Date] ), ExchangeRate[Date] <= vCurrentDate )
VAR vResult =
CALCULATE ( MAX ( ExchangeRate[Rate] ), ExchangeRate[Date] = vMaxDate )
RETURN
vResult
Proud to be a Super User!
This is what it looks like when I use that formula. I'm using DirectQuery if that matters..
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
94 | |
83 | |
66 | |
59 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |