Unlock Weather Insights: How You Can Use Power BI with OpenWeatherMap — Part 5

Andrew Hubbard
Microsoft Power BI
Published in
4 min readJan 13, 2024
Sample image from the weather dashboard we will create. Background image in dashboard Photo by Tim Foster on Unsplash
Sample image from the weather dashboard we will create. Background image in dashboard Photo by Tim Foster on Unsplash

In the preceding sections of this series, we’ve meticulously crafted the foundation of our weather dashboard. Our journey began with the establishment of a web source, seamlessly connecting Power BI to the Open Weather API. Subsequently, we fine-tuned the data for enhanced readability, undertaking renaming columns to facilitate smoother reporting. Having completed these preparations, we can now start the exciting venture of constructing our very own weather dashboard.

One distinctive element I envisioned for my dashboard was a dynamic background, capable of adapting to the current weather. While conventional business reports typically avoid such animated features, I crafted this dashboard with a more laid-back audience in mind - individuals who are keen on quickly checking the weather. A small hurdle emerged as Power BI doesn’t inherently support dynamic canvas background images. Fear not, as I found a solution within the vast repository of the Power BI AppSource store.

The original visual I employed is no longer available; however, a free and equally efficient alternative, “Simple Image,” came to the rescue. In the subsequent tutorial, we’ll delve into the utilization of this visual to achieve the coveted dynamic background effect. To guide you through this process, I’ll furnish you with a meticulously crafted query containing links to images and credits sourced from Unsplash.

Now, let’s seamlessly integrate this Dynamic Dashboard Images Query into your Power BI environment:

Adding Dynamic Dashboard Images Query to Power BI

  • Copy the code enclosed in the box below.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("7ZrbbuM4EoZfRQiwd8OEkiiJWiCYSU/SOXXQ6U7SxwwCSqQstilRTVJRnBfYq32fvd95sC1ZTnfHg8E48NiBgQVysCWDRbE+Vv1V9OfPW4bJeuunrdK5xv5zZ0dWbCTsdlvbRjFbbue62mlK7TTySUgJSSmOaBqjgLI4jqmfsgD//HWX4usW4yDudsMgmb1mrdO7hTYVc8OFQrrd3OhmeCfvlMx2TYbINt4OH65JvnsWdndnX/bCYv8FPTu669hhirOJ3318z1VxdEeLw3dtf2/6eu8f4T78wBOc97P0sonXDxXmzCuNKHavvz3Zo0f6RdYjUbVW5j+3rrrJde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tF0WiRf75njdpFXSugUVFA0oCKiA+kGAUkwxJyTLKE7mSfM3gLSRNqy+bVdTEx32g3vv2t//LX//l7iFP0tx1TBXdmyCMuG6vuEwSCkAadgr6KBtjxn9cPnqdO0KSt8KkzPrnibFKQWG4hSnUObF2McYFwFOBJkDKd2EkNVL8ZtpIdatJmDNCj3QqXuDlaVYAsltxdA0qAVwhfK2alVrH1pTb8Myxp/w5M2bdfc//7/sz7LsP3RpZG/TSjfxuJH390osqGVxFAZRkkJiiFCYQ1rw/TwBQTufF4JN2M5c3lcMitQVldZcWhieeeetM9I7N2DPLHfwMevaZIrlY2RLab43bb61azqm+hqsPxixffZw813ng/evj6qDytylz9IlrDRsDFBCTyjF49THJIVRSByigHGQTwHHNBNz1MXpBlDXlG3OW12PvmYrWf5zGN/b7w0sWTuNjG6bXrc2QvdFFCygtT1I7AEsQBFUPOodiS5rdHz6wcoT/vFZzjL0aEFBQkh/gAaiBFNEOIl5lPuFH8xFMEKiDWCp00ZxO9OKCgLZavIjlORG5mPvSEB6nCyHVQbssNyhBqBxPU1h8qk9/Lgfnrxeey/nSakvwhGBKOSnSRAisClyxqmfpcEmFt9NKR1bzbnXeSmVbBrhXTKTwUekyMulkOlkzXWHRmo4ev3exfnx6yJ9nc3QrRTdtAEtmEKd1rPGM8gx8777Qu7z1/nxarbIX1P2lNZzMBVY8BtSVGQiDbOEBxGbK5rCaBNUlmVuwmqnV/SFkkLy0ruY2ViKsz9t6RjNOLqauIvshgUfD57lrH5Q7Yu3CkGo0wBkeJTSBAkSZD4JCUuT+bp7I6IV7JxK13ys2K2sV7N/3w4mvNPBxnIBa3qoOhxVTHs3TirXy/XCIQVVF6qjCEXVlX//bp0p79oMNP32Pw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Weather = _t, URL = _t, #"Unsplash Credit" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Weather", type text}, {"URL", type text}})
in
#"Changed Type"
  • Open your weather dashboard report in Power BI.
  • Access the Power Query Editor by selecting Transform data.
  • Select New Source from the Home tab.
  • Opt for a Blank Query from the options.
The Power Query New Source pop-up menu with Blank Query selected.
Power Query New Source Pop-up Menu with Blank Query selected.
  • Right-click on the newly created query, rename it to “Wallpaper,” and navigate to the Advanced Editor.
The Power Query pop-up options window for the Wallpaper query. This list of options shows when you right-click on a query.
Power Query pop-up options for the Wallpaper query.
  • Swap the template code by selecting the existing code, then paste the new code into the designated code box
  • Click Done to save your changes.

Given that the Simple Image visual doesn’t accept a measure as a URL source, a crucial step is to merge the wallpaper query with the current weather query. Remember, default images won’t function if the current weather cannot align with any in the wallpaper query. Although creating a conditional column is beyond the scope of this tutorial, it’s a concept worth exploring for more advanced dashboard development.

To seamlessly merge these queries, follow these straightforward steps:

Merging Wallpaper query with Current Weather query

Merging the queries is a straightforward task. I will explain how to do this in the following steps.

  • Click on the Current Weather query.
  • Choose Merge Queries from the toolbar, on the right-hand side.
  • In the Merge window, opt for the wallpaper query.
Selecting the Wallpaper query for merging with Current Weather query
  • Select the columns to match for merging (Current Weather’s weather.description and Wallpaper’s Weather), as illustrated below.
The Merge queries option box showing the current_weather and Wallpaper queries with the columns to match selected.
Selecting the columns to match for the merge of the two tables.
  • Click OK to complete the merge.

This action will introduce a new column named “Wallpaper” with a table entry. To access the URL and Unsplash credits, expand this table column by clicking the expand button on the column header. Ensure to uncheck “Use original column name as prefix” and deselect the Weather column.

The Power Query expand tables option window with the desired options selected.
Expand Table Options showing the desired options selected.
  • Finally, click on OK.

These additional steps in merging tables are imperative for optimal utilisation of the Simple Image visual. In our forthcoming instalment, we’ll delve into the creation of DAX measures for the dashboard, and start constructing visually compelling representations. Stay tuned for the exciting developments in our weather dashboard journey!

Don’t forget to subscribe to

👉 Power BI Publication

👉 Power BI Newsletter

and join our Power BI community

👉 Power BI Masterclass

--

--

Andrew Hubbard
Microsoft Power BI

A Data analyst using Microsoft Power BI to create visualisations. With a keen interest in mental well being.