Forum Discussion
Exchange Rates - best website to use for Historical data
- 6 years ago
Hello PiyushH1
you will get a table for every day, depending on your URL that your are sending to the site
and here the code
let Quelle = Web.Page(Web.Contents("https://www.xe.com/de/currencytables/?from=EUR&date=2019-12-17")), Data = Quelle{0}[Data], #"Geänderter Typ" = Table.TransformColumnTypes(Data,{{"Währungscode ▲▼", type text}, {"Währungsname ▲▼", type text}, {"Einheiten pro EUR", type number}, {"EUR pro Einheit", type number}}) in #"Geänderter Typ"Copy paste this code to the advanced editor to see how the solution works
If this post helps or solves your problem, please mark it as solution.
Kudos are nice to - thanks
Have fun
Jimmy - 6 years ago
Hi PiyushH1
As tested, this thread would be helpful.
https://community.powerbi.com/t5/Service/Historical-exchange-rate-API/td-p/742021
The code in my Advanced editor is:
Query1
let Source = {Number.From(Date.AddDays(DateTime.Date(DateTime.LocalNow()),-Duration.Days(Date.From(DateTime.LocalNow())-#date(2015,1,1))))..Number.From(DateTime.Date(DateTime.LocalNow()))}, #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type date}}), #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Column1", "Date"}}), #"Invoked Custom Function" = Table.AddColumn(#"Renamed Columns", "ExchangeRates", each Fn_GetHistoricExchangeRates(Date.ToText([Date],"yyyy-MM-dd"))), #"Expanded ExchangeRates" = Table.ExpandTableColumn(#"Invoked Custom Function", "ExchangeRates", {"Currency", "Rate"}, {"Currency", "Rate"}), #"Changed Type1" = Table.TransformColumnTypes(#"Expanded ExchangeRates",{{"Rate", type number}, {"Currency", type text}}) in #"Changed Type1"Fn_GetHistoricExchangeRates
let Source = (Date as text) => let Source = Json.Document(Web.Contents("https://api.exchangeratesapi.io/" & Date & "?base=USD")), rates = Source[rates], #"Converted to Table" = Record.ToTable(rates), #"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Name", "Currency"}, {"Value", "Rate"}}) in #"Renamed Columns" in SourceBest Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. - 6 years ago
Hi PiyushH1
Close&&apply, select Edit queries->edit parameter
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi PiyushH1
Close&&apply, select Edit queries->edit parameter
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi v-juanli-msft , I'm using your pbi report and faced an error issue while loading the data. Actually, I'm facing the same kind of issue related to the historical exchange rate.
Can you please let me know why it is asking for API key? If we need to provide it, can you mention it? Thanks