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

Andrew Hubbard
Microsoft Power BI
Published in
4 min readMay 26, 2024
Photo by Phuc Duong on Unsplash

Previously in this series, we added the sunrise and sunset icons and information to the dashboard. In this part of the series, we will add the air quality information to the current weather card. This will complete the information for the card. Follow the steps below to add the air quality to the card. For the air quality I kept it simple and just used the air quality index number to show the air quality and the description for the air quality is taken from the Quality Description in the air pollution table.

Adding Air Quality Information

To add the air quality information, we will add a card visual to the dashboard. To add a card to the report, select the card visual from the box that allows you to select visuals for your report. This is either from the Insert menu or on the Build Pane located at the right-hand side of the window.

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.
  • We will now set the height and width of the card.
  • Change the height in the Size and position options from a value of 300 to 35.
  • Change the width in the Size and position options from the current value of 300 to 350 by clicking in the width box and entering the new value.
  • Change the horizontal position in the Size and position options from the current value of 100 to 50 by clicking in the horizontal box and entering the new value.
  • Now change the vertical position in the Size and position options from the current value of 0 to 610 by clicking in the vertical box and entering the new value.
  • Turn off the background colour for the card by clicking on the background toggle button. This is in the Size and position options for the card.

Now we need to add the measure of Air Quality 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 of the Air Quality measure. The card should now show the current Air Quality. But the font is too large to show the text properly.

We will need to format this visual further. We will reduce the size of the font and we will add the conditional formatting for the air quality. First, we will reduce the font size and change the font.

  • Select Callout Value from the list of options in the visual pane for the card
  • Change the font to DIN and set the font size to 15.
  • Click on the Bold icon to make the value bold so it pops out a bit more.
  • If you cannot see the air quality information clearly. It means that the category label is showing. Clicking on the category label toggle button.

Now we will set the callout value conditional formatting. I am using the following colours ranging from green for the best air quality through yellow, then orange to dark red for the worst air quality. Adjust the colours I’ve used to suit your preferences.

Setting Air Quality Conditional formatting.

  • Open the Callout Value option from the list options for the card.
  • Click on the fx button next to the colour option for the Callout Value. This will open the conditional formatting rules. First, we need to change the field used for the rules. It is currently showing “Air Quality” which is the text that is shown. We need to use the Air Quality Index number (aqi) from the Air Quality table.
  • Click on the dropdown arrow for “What field should we base this on?” navigate to the Air Quality table and click on the aqi field.
  • We can leave the summarization as Sum; the table only contains a single row.
  • We need to change the rule from if value > = to = click on the dropdown and select = from the list of conditions.
  • In the box showing Min enter 1.
  • Next click on the dropdown arrow in the box showing a colour to expand the list of colours.
  • Select More colors…
  • Enter #00D724 into the Hex box.
  • Now click on the new rule button to add the next rule.

We will need to carry out the above steps for the remaining air quality levels. I will summarise the information here:

  • level 2, For the rule colour, use hex code #E1C233
  • level 3, For the rule colour, use hex code #EB895F
  • level 4, For the rule colour, use hex code #D64550
  • level 5, For the rule colour, use hex code #A1343C

The above steps will allow the text colour to change depending on the air quality level.

We have added all the items for the current weather information card. In the next part of this series, we will add the thermometer visual that shows the temperature in a style similar to a traditional thermometer.

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.