2024 Week 19 | Power BI: Radial Plots using Line and Scatter Charts with trig functions

Introduction

In this week’s challenge, we are experimenting with Radial Plots using Line and Scatter Core Visuals.

Radial Lollipop charts are an alternative to radar charts.

Power BI does not have Polar Plots, only cartesian plots, so we will need to use trigonomic functions within DAX to calculate the cartesian X and Y position of points.

Requirements

  1. Obtain 5 years of data from https://geodesyapps.ga.gov.au/sunrise or use your own alternatives

For the Scatter Plot:

  1. Model the Data in Power Query to create a table consisting of Year-Month, Year Number, Month Number, Hours
  2. Create a measure to determine the angle of the points for each month. TIP: degrees = 360/number of categories ; to convert from degrees to radians, multiply the number of degrees by π/180
  3. Create a measure to determine the distance of the points from the centre. TIP: For 5 years, plot the first year as radius = 1, and the last year as radius = 6. Calculate the difference of the current year and last year.
  4. Create a measure to calculate the X and Y coordinates. TIP: x = rSinθ ; y = rCosθ ; where r = radius and θ = angle
  5. create an image of equally spaced concentric circles (using PowerPoint layer circles of width and height 1, 2, 3, 4, 5 etc. and save as SVG)
  6. Add a Scatterplot to the visual canvas
  7. Add this image and the plot area background and adjust the transparency to suit
  8. Add the Year-month field to the Values field well, and the X and Y measures to the relative field wells and the hours field to the Size field well
  9. Format the visual

For the radial lollipop:

  1. Model the Data in Power Query to create a table consisting of Year-Month, Year Number, Month Number, Hours (per step 1 above)
  2. In PQ or Using a DAX Calculated Table, create a summarized table of the average of daily hours by year and month and add a column “Point”, with data values of “Point”. Union this summarized table with another create a summarized table with values of zero for each year and month and add a column “Point”, with data values of “Base”. The Base points will be the start of the lollipop, the Point points will be the end of the lollipop
  3. Create a calculated column for Angle (per scatter plot above)
  4. Calculated column for X and Y (per scatter plot above)
  5. Add the X, Y fields to a line chart visual
  6. Place the month as the category field
  7. Add markers, format the visual as desired using custom labels to show the Average Daylight hours for Points = “Points” and null for Points = “Base” instead of the Y values.
 

 

Dataset

https://www.kaggle.com/datasets/sujaykapadnis/star-trek-timelines?select=tlBooks.csv

Or

Supplement with https://en.wikipedia.org/wiki/Timeline_of_Star_Trek#Before_Common_Era

Share

After you finish your workout, share on Twitter using the hashtags #WOW2024 and #PowerBI, and tag @MMarie, @shan_gsd, @KerryKolosko. Also 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

Scroll to Top