2021 Week 43 | Power BI: Maps with a Distance Radius

Introduction

It’s the final week of mapping month! This week we are plotting points on a map within a selected radius. It’s common to want to see locations, such as stores or restaurants that are nearby to a selected location. This week we are exploring one way to do that in Power BI. This involves a fun bit of DAX and some conditional formatting. 

This week we are mapping Dutch Bros Coffee locations. This is a coffee chain based in Oregon, USA that has locations in about 13 states throughout the country. I enjoy their cold brew, but they have many hot, cold, and frozen drink options. 

Requirements

  • Retrieve the Dutch Bros location data and the list of cities from data.world
  • Create a map visual that plots the Dutch Bros locations using longitude and latitude. 
  • Use the “CityLatLong.xlsx” table to populate state and city slicers. 
  • Create a DAX calculation that uses the haversine formula to calculate distance from the selected city in the slicers to each Dutch Bros location. (I chose to use kilometers, but feel free to do miles if you prefer.)
  • Create a slicer to allow users to filter on distance from store locations to the selected city.
  • Add a visual (I used a table) to list the store addresses and the distance from the selected city. 
  • Configure the map and table so they only show locations within the selected distance radius. (Hint1, Hint2)

Dataset

This challenge uses data provided on data.world. You can use the data.world connector in Power BI (recommended) or download the Excel file to your local machine. You will need to log in to data.world to retrieve the data, but accounts are free. 

Share

After you finish your workout, share on Twitter using the hashtags #WOW2021 and #PowerBI, and tag @JSBaucke@MMarie, @shan_gsdAlso make sure to fill out the Submission Tracker so that we can count you as a participant this week in order to track our participation throughout the year. 

Solution

6 thoughts on “2021 Week 43 | Power BI: Maps with a Distance Radius”

  1. Hi, just wanted to check if I can find distance of coffee shops from a particular location, which I can keep changing. Say distance from a Metro or Distance from a particular house number/Lat-Long or particular shop

    1. Hi. Yes, that is possible. The challenge is that you have to provide lat and long for the source and destination. I provided the lat and long of the cities in my source data. It would be much trickier if you needed to do that on the fly (since you wouldn’t have pre-populated lat and long for your source), but maybe it could be done using a Power App embedded in the report. If you just want to show distance from a metro area, you just have to add the metro area to your dataset and assign it a lat and long value.

  2. Is it possible to make a search radius for PowerApps and filter locations? Would be nice to hear from you. Thnaks in advance.

    1. Meagan Longoria

      Are you asking if you can embed a Power BI visual in a Power App and then use the location from a device as retrieved from the app to filter locations? You could probably do that. You would need to adjust how the location is input into the map.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top