Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hello all!
I would like to have an online source for temperature data. Something like maximum, minimum, average, other parameters might as well be useful, maybe...
Could you suggest me a good online source for this? I googled it with no success so far. The location that I am interested in is Leiria, Portugal.
Thanks in advance.
Solved! Go to Solution.
It depends what you mean by historical 🙂
Wunderground seems to cover Leiria from a local weather station, and gave me a table of daily data back to 2010 - see https://www.wunderground.com/personal-weather-station/dashboard?ID=IPORTUGA9#history/s20011229/e2016... They may have other data there as well, but you may need to dig for it.
You can google how to 'scrape' web pages with Power Query (if they don't provide a JSON API or CSV download) - the top half-dozen entries all look good: https://www.google.com.au/search?q=power%20query%20scrape%20web%20page&rct=j
This one even looks specifically at scraping a Wunderground page: https://www.concurrency.com/blog/w/using-power-query-m-language-for-scraping-any-webs
And there's a new blog on importing CSV files at https://gqbi.wordpress.com/2016/11/23/power-bi-using-parameters-for-flat-file-csv-excel-sources/
Good luck.
This is a step by step blog for you:
https://medium.com/analytics-vidhya/how-to-import-weather-data-into-power-bi-afccdd12c8f0
@Anonymous @v-yuezhe-msft
Thanks for your replies. I need historical data for every day, and I couldn't find it on these services. Am I missing something?
Besides, could you teach me or point me to some resources that may help me to grab the data I need into PBI?
Thanks!
It depends what you mean by historical 🙂
Wunderground seems to cover Leiria from a local weather station, and gave me a table of daily data back to 2010 - see https://www.wunderground.com/personal-weather-station/dashboard?ID=IPORTUGA9#history/s20011229/e2016... They may have other data there as well, but you may need to dig for it.
You can google how to 'scrape' web pages with Power Query (if they don't provide a JSON API or CSV download) - the top half-dozen entries all look good: https://www.google.com.au/search?q=power%20query%20scrape%20web%20page&rct=j
This one even looks specifically at scraping a Wunderground page: https://www.concurrency.com/blog/w/using-power-query-m-language-for-scraping-any-webs
And there's a new blog on importing CSV files at https://gqbi.wordpress.com/2016/11/23/power-bi-using-parameters-for-flat-file-csv-excel-sources/
Good luck.
Perfect! Data as I want it
Thank you!
It would be super helpful if you can share how you got it to work - even if just from a hign level.......
It's in Portuguese, but it is good enough to understand.
let
Source = Web.Page(Web.Contents("https://wunderground.com/history/airport/LPMR/2017/1/1/CustomHistory.html?dayend=31&monthend=12&year...")),
Data1 = Source{1}[Data],
#"Changed Type1" = Table.TransformColumnTypes(Data1,{{"2017", type text}, {"Temp. (°C)", type text}, {"Temp. (°C)2", type text}, {"Temp. (°C)3", type text}, {"Ponto de Orvalho (°C)", type text}, {"Ponto de Orvalho (°C)2", type text}, {"Ponto de Orvalho (°C)3", type text}, {"Humidade (%)", type text}, {"Humidade (%)2", type text}, {"Humidade (%)3", type text}, {"Sea Level Press. (hPa)", type text}, {"Sea Level Press. (hPa)2", type text}, {"Sea Level Press. (hPa)3", type text}, {"Visibilidade (km)", type text}, {"Visibilidade (km)2", type text}, {"Visibilidade (km)3", type text}, {"Wind (km/h)", type text}, {"Wind (km/h)2", type text}, {"Wind (km/h)3", type text}, {"Precip. (mm)", type text}, {"Eventos", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type1", "Date.Month", each if [2017] = "Jan" then "01/01/2017" else if [2017] = "Fev" then "01/02/2017" else if [2017] = "Mar" then "01/03/2017" else if [2017] = "Abr" then "01/04/2017" else if [2017] = "Mai" then "01/05/2017" else if [2017] = "Jun" then "01/06/2017" else if [2017] = "Jul" then "01/07/2017" else if [2017] = "Ago" then "01/08/2017" else if [2017] = "Set" then "01/09/2017" else if [2017] = "Out" then "01/10/2017" else if [2017] = "Nov" then "01/11/2017" else if [2017] = "Dez" then "01/12/2017" else "" ),
#"Reordered Columns" = Table.ReorderColumns(#"Added Custom",{"Date.Month", "2017", "Temp. (°C)", "Temp. (°C)2", "Temp. (°C)3", "Ponto de Orvalho (°C)", "Ponto de Orvalho (°C)2", "Ponto de Orvalho (°C)3", "Humidade (%)", "Humidade (%)2", "Humidade (%)3", "Sea Level Press. (hPa)", "Sea Level Press. (hPa)2", "Sea Level Press. (hPa)3", "Visibilidade (km)", "Visibilidade (km)2", "Visibilidade (km)3", "Wind (km/h)", "Wind (km/h)2", "Wind (km/h)3", "Precip. (mm)", "Eventos"}),
#"Changed Type" = Table.TransformColumnTypes(#"Reordered Columns",{{"Date.Month", type date}}),
#"Filled Down" = Table.FillDown(#"Changed Type",{"Date.Month"}),
#"Filtered Rows" = Table.SelectRows(#"Filled Down", each ([2017] = "1" or [2017] = "2" or [2017] = "3" or [2017] = "4" or [2017] = "5" or [2017] = "6" or [2017] = "7" or [2017] = "8" or [2017] = "9" or [2017] = "10" or [2017] = "11" or [2017] = "12" or [2017] = "13" or [2017] = "14" or [2017] = "15" or [2017] = "16" or [2017] = "17" or [2017] = "18" or [2017] = "19" or [2017] = "20" or [2017] = "21" or [2017] = "22" or [2017] = "23" or [2017] = "24" or [2017] = "25" or [2017] = "26" or [2017] = "27" or [2017] = "28" or [2017] = "29" or [2017] = "30" or [2017] = "31")),
#"Added Custom1" = Table.AddColumn(#"Filtered Rows", "Date", each Date.AddDays([Date.Month],Value.FromText([2017])-1)),
#"Reordered Columns1" = Table.ReorderColumns(#"Added Custom1",{"Date", "Date.Month", "2017", "Temp. (°C)", "Temp. (°C)2", "Temp. (°C)3", "Ponto de Orvalho (°C)", "Ponto de Orvalho (°C)2", "Ponto de Orvalho (°C)3", "Humidade (%)", "Humidade (%)2", "Humidade (%)3", "Sea Level Press. (hPa)", "Sea Level Press. (hPa)2", "Sea Level Press. (hPa)3", "Visibilidade (km)", "Visibilidade (km)2", "Visibilidade (km)3", "Wind (km/h)", "Wind (km/h)2", "Wind (km/h)3", "Precip. (mm)", "Eventos"}),
#"Removed Columns" = Table.RemoveColumns(#"Reordered Columns1",{"Date.Month", "2017", "Ponto de Orvalho (°C)", "Ponto de Orvalho (°C)2", "Ponto de Orvalho (°C)3", "Sea Level Press. (hPa)", "Sea Level Press. (hPa)2", "Sea Level Press. (hPa)3", "Visibilidade (km)", "Visibilidade (km)2", "Visibilidade (km)3", "Wind (km/h)", "Wind (km/h)2", "Wind (km/h)3", "Precip. (mm)"}),
#"Replaced Value" = Table.ReplaceValue(#"Removed Columns","","",Replacer.ReplaceValue,{"Eventos"}),
#"Replaced Value1" = Table.ReplaceValue(#"Replaced Value","#(tab)","",Replacer.ReplaceText,{"Eventos"}),
#"Replaced Value2" = Table.ReplaceValue(#"Replaced Value1","#(cr)","",Replacer.ReplaceText,{"Eventos"}),
#"Replaced Value3" = Table.ReplaceValue(#"Replaced Value2","#(lf)","",Replacer.ReplaceText,{"Eventos"}),
#"Replaced Value4" = Table.ReplaceValue(#"Replaced Value3","#(cr)#(lf)","",Replacer.ReplaceText,{"Eventos"}),
#"Replaced Value5" = Table.ReplaceValue(#"Replaced Value4","#(00A0)","",Replacer.ReplaceText,{"Eventos"}),
#"Replaced Value6" = Table.ReplaceValue(#"Replaced Value5",",",", ",Replacer.ReplaceText,{"Eventos"}),
#"Renamed Columns" = Table.RenameColumns(#"Replaced Value6",{{"Date", "Data"}, {"Temp. (°C)", "Temperatura Máx."}, {"Temp. (°C)2", "Temperatura Média"}, {"Temp. (°C)3", "Temperatura Mín."}, {"Humidade (%)", "Humidade Máx."}, {"Humidade (%)2", "Humidade Média"}, {"Humidade (%)3", "Humidade Mín."}}),
#"Changed Type2" = Table.TransformColumnTypes(#"Renamed Columns",{{"Data", type date}, {"Humidade Mín.", type number}, {"Humidade Média", type number}, {"Humidade Máx.", type number}, {"Temperatura Mín.", type number}, {"Temperatura Média", type number}, {"Temperatura Máx.", type number}})
in
#"Changed Type2"
Thanks!
Hi @Anonymous,
Please check if the following link provides your expected temperature data.
http://en.climate-data.org/location/140/
Thanks,
Lydia Zhang
Wunderground cover lots of places and have a rich JSON API - see https://www.wunderground.com/weather/api
But you have to pay for more than 500 calls/day or 10 calls per minute.