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

Andrew Hubbard
Microsoft Power BI
Published in
6 min readMar 24, 2024
Sample Weather Dashboard Screenshot showing weather as at 21/3/23
Sample image from the weather dashboard we will create. Background image in dashboard Photo by Tim Foster on Unsplash

In the last part of the series, we added the title bar and added the text to the report. In this part, we will add a card to hold the information for Temperature Feels Like. We will add conditional formatting to this card so the colour changes according to the temperature range. After this, we will copy and paste this card and update the fields used for the other cards. Please note that my Power BI Desktop has on-object interaction enabled in the Preview Options and all the steps that I detail will work in that setup. If you haven’t enabled on-object interaction, you will need to adjust the steps accordingly.

Adding Temperature Cards to the Dashboard

To add cards to the dashboard, select the card visual from the list of visuals in the insert menu or the build pane. The image below shows my Power BI Desktop as I have enabled on-object interaction in the Power BI Preview settings. If you haven’t enabled on-object interaction, then you can select the card visual from the visualizations pane.

Image showing Selecting the card visual from the list of Power BI visuals
Selecting the card visual

After you have added the card to the canvas, we need to resize the canvas and also duplicate it. To resize the card, follow the following steps:

  • Click the format button, at the far right-hand side of the Power BI Desktop window.
  • Expand the size and style option on the visual tab in the format pane.
  • Set the height to 60 and the width to 160.

We can also position the card by setting the horizontal and vertical values in the size and style options. Since the size and style options should still be open, as we have just set the height and width of the card. Change the horizontal and vertical values in the size and style options to the following.

  • Horizontal: 20
  • Vertical: 80

Now we need to add the measure for “Temperature Feels Like” to the card.

  • In the build a visual pane, click on the fields “Add data” box. A Data pop-up window should appear.
  • Expand the “_All Measures” table to see the list of measures we have created.
  • Click in the checkbox for the “Feels Like Temperature” measure. The card should now show the current feels like temperature.

There is some further formatting to undertake. We will reduce the size of the font and we will add the conditional formatting. We will now set the conditional formatting for the card. The values I’m using are suitable for my environment. Please adjust the values to suit your environment.

Adding Card Conditional Formatting for Background

To add the conditional formatting for the card background, follow the steps below.

  • In case Power BI has not selected the card, click on the card visual we just created to select it.
  • Expand the Size and style option in the visual tab of the format pane by clicking on it.
  • Now expand the background option by clicking on it.
  • If the background toggle button is showing off, click on it to turn it on.
  • Click on the “fx” button for the color option.
Image showing the background options in the Power BI Format pane under Size and style options.
Background option showing color with “fx” button.

The Color — Size and style — Background conditional formatting window will appear with a basic rule applied. We need to change this. The following steps detail how to change the rules.

  • Select “Rules from the “Format style” dropdown option list.
  • Click on the “What field should we base this on?” dropdown option list.
  • Expand the “Current Weather” table.
  • From this list of fields, click on “feels_like”
Image showing part of the background conditional formatting window
Selecting Formatting Rules in the Background conditional formatting window.
  • We will now change the Summarization from Sum to Minimum. Click on the down arrow to expand the summarization dropdown list.
  • Select minimum from the list of summarizations.
The expanded Summarization dropdown list.

Now we need to add the conditional formatting rules. Adjust these values as required.

  • Change the Min value in the current rule to 20. (Or a suitable value for you).
  • Change the 0 value to 33 (Or a suitable value for you).
  • Click the down arrow to expand the colours to use. We will use an orange colour for this rule. You can select the orange colour by clicking on it or you can click on “more colors…” to open a window with hex codes and red, green and blue values. As shown here.
Image showing the more colors option for background conditional formatting
More colors option in background conditional formatting.
  • Press the backspace button on your keyboard to clear the current hex value.
  • Enter the following in the hex text box to use a slightly different shade of orange to the orange in the current theme. #EB895F as shown below.
  • Now click the New Rule button to add a second condition.
  • Change the Min value to 33 (or a suitable value for you).
  • Delete the 0 value and Power BI will replace that with Max.
  • Now follow the step to expand the colours window.
  • Select a red colour or click on “more colors…” to add a custom value.
  • For this rule, we will use #A13436 for the hex code. So delete the old hex code and type in the new hex value.
  • Now click the New Rule button to add the third condition.
  • Leave the Min value as it is.
  • Change the 0 value to 20 (or a suitable value for you).
  • Select a blue colour or click on “more colors…” to add a custom value.
  • For this rule, we will use #A094780 for the hex code. So delete the old hex code and type in the new hex value.

The completed rules should look like this.

Completed Background Conditional Formatting Rules
  • Now click OK to save the rules.

Adding a Visual Border to the Card

We will use the same rules we have created for the visual border for the card.

  • First, we need to turn on the visual border. By expanding the Size and style option and clicking the visual border toggle button to turn it on if it is off.
  • Once you have turned on the visual border, then expand the visual border options. Now we will format the visual border. Follow the same steps that we used for creating the background conditional formatting. We are doing this so that we can have a card with rounded corners and that the border colour matches the current colour.
  • When you have completed creating the rules, then click OK to save them.
  • Now click in the rounded corners box and enter 10 to set a rounded corner of 10 pixels.

Now we need to format the text on the card.

  • Click on Callout Value to expand it.
  • Change the font size value from 45 to 24 to give us some space on the card.
  • Click on the color down arrow to expand the colours window.
  • Select White from the list of colours.

Final Card Formatting

The following will help with some final formatting on the card.

  • Click on the Category Label toggle button to turn off the Category Label, as we don’t want to see the category label.
  • Click on the Title toggle button to turn on the title. As we will use the title instead of the category label.
  • Enter "Temperature Feels Like" in the title text box.
  • Change the Font to DIN if it is not showing DIN as the font.
  • Change the Font Size to 11.
  • Finally, change the font colour to white.

We have now added the first dynamic visual to the dashboard. In the next part of this series of articles on building a weather station dashboard, we will complete the other two cards. These will be much easier to create, as we just need to copy and paste and change the fields used in the cards.

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.