Categories
Data

Mastering Visual Trends Analysis in Power BI

This post explains key methods for displaying changes over time in Power BI. It covers transforming date formats in Power Query, creating a date table, converting UNIX timestamps, and using visualizations like line graphs, column graphs, area charts, Gantt charts, and histograms. The post also provides steps for accurate running totals and highlights both DAX and simpler solutions.

Visualising trends over time helps us make decisions – for instance by telling us which marketing campaign was the most successful, getting a sense of what the future might look like, or to see where profit can be maximised as an organisation scales.

This short post will explain the key methods for displaying changes over time in Power BI.

Getting dates into the right format

Date data is fantastic, and Power BI handles it well by default. Before progressing you should be familiar with the following practices:

  • In Power Query, transform any date/time/timezone columns to ‘Date’ if the time and timezone aren’t useful to improve your report’s performance
  • Where your report has more than one table with a date column, add a ‘Date’ table to your report. Creating a date table
  • Where your ‘date’ column is a UNIX timestamp it will need to be transformed. Convert UNIX timestamp.

Visualisations to show metrics over time

The most popular visualisation to use to show trends over time is the ‘line’ graph; however depending on your needs the following can also be useful:

  • Column graphs can be easier to see differences between fewer time blocks – three year periods for instance
  • Area charts can be a useful variation on line graphs where a running total is being shown
  • Gantt charts are great for visualising project work over time
  • A clustered column or histogram showing resource availability in each time period, aligned beneath a Gantt chart, can show peaks and troughs and allow the smoothing of resources accordingly

Building your Visualisations

Sum or Average over time – the simplest graph to generate, it displays the actual figures for a particular date. Pick the line graph visualisation, drag your date field into the x-axis and the value you want to track into the y-axis and the trend over time will display.

Aggregated over time – Similar to the above, only adds the numbers from the previous time period to the next. Add a ‘quick measure/running total’ measure to your report and use this for your y-axis. You might consider using an Area graph as an alternative to a line graph for this purpose.

Sometimes the structure of our data doesn’t make visualising a running total over time easy however. Let’s say you have the following data set, and want to show the growth of membership over time:

NameMemberJoinedLeft
Jane120/02/2020
Peter125/04/2021
Jack023/07/202018/09/2022
Gertrude123/11/2022
Robin020/12/202018/03/2021

A running total on the ‘Member’ column will be inaccurate, since the line will only ever go up despite people leaving. A simple way to achieve the desired result can be done in Power Query:

  1. Create a duplicate of the table
  2. In first table, filter to Member=0, replace 0 with -1, remove the ‘Joined’ column, rename the ‘Left’ column to ‘Joined’, and disable load
  3. In the second table replace 0 with 1 in the Member column, remove the ‘Left’ column, and append the first table to it. It should look something like this:
EmployeeMemberJoined
Jane120/02/2020
Peter125/04/2021
Jack123/07/2020
Gertrude123/11/2022
Robin120/12/2020
Jack-118/09/2022
Robin-118/03/2021

Our running total line graph should now dip where members have left.

This can also be achieved without any data transformations using DAX as outlined in HR Analytics – Active Employee, Hire and Termination trend. I prefer the simpler solution above however.

Gantt charts – Microsoft provide a free minimal Gantt chart as a custom visualisation. The chart lacks more advanced features – like dependencies – which are available in MS Project. Building a Gantt Chart using Power BI. Numerous paid-for Gantt charts are also available from the custom visual store.

Histograms for Project Management – When set beneath a Gantt chart, a histograms are invaluable to understand where we can expect peaks and troughs in work to occur – and potentially shuffle tasks around to better allocate project resources. To do so, we need to understand how much resource is available across the project, how much resource each task within the project is expected to take, and the boundaries of time each task has. Once we have that data, we can use an ‘Events in progress’ calculation to build a histogram using the clustered column visualisation. See Events in Progress


Discover more from Information Handyman

Subscribe to get the latest posts sent to your email.

Leave a ReplyCancel reply