Forum Discussion

PiyushH1's avatar
PiyushH1
Helper I
6 years ago
Solved

Exchange Rates - best website to use for Historical data

Hi Team , How are you ? can anyone help me to suggest best historical rates website which i can use for BI report which shows all currency rates from 2015 to now  & it should be updated automatical...
  • Jimmy801's avatar
    Jimmy801
    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

  • v-juanli-msft's avatar
    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
        Source

    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.

  • v-juanli-msft's avatar
    v-juanli-msft
    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.