Data Structure for Columnar Group View

This document explains the process to dynamically convert a standard data structure to the data structure required to plot a columnar group view in the xViz Performance Flow visual

Image 1: Column Group (Swim lane) View in xViz Performance Flow | Power BI

Let’s explore this with an example. We have a dataset with specific IDs, but we don't have the Parent ID, Group ID, and Subtree ID included. However, we can easily create these columns in Power Query using a few transformation steps.

Steps to dynamically convert your data for the Swimlane view:

  1. We have a Source table with the columns Id, Title, Subtitle, and Group Name. The Group Name column represents the groups that we used for grouping to create swim lanes.

Image 2: Source data structure
  1. We sort the data by "Group Name" column to ensure that unique group names are arranged in the correct sequence.

Image 3: Data sorted by the Group Name column

Sort the Group Name column according to your requirements for preferred group order. This will ensure that the Subtree Id and Group Id are ordered according to the sorted column.

  1. Add an Index column starting from 1 - Add an index column | Power Query

Image 4: Index column added
  1. Next, we will add the "Subtree Id" column - Add a custom column | Power Query Create a Custom Column - paste the code below as its definition and name the column as "Subtree Id":

This will result in a new column named "Subtree Id" is displayed in the image below:

Image 5: Subtree Id column added
  1. Then, we will add the "Parent Id" column - Add a custom column | Power Query Create a Custom Column - paste the code below as its definition and name the column as "PId":

This will result in a new column named "PId" is displayed in the image below:

Image 6: Added Parent ID column
  1. Now, we will add the "Group Id" column- Add a custom column | Power Query Create a Custom Column. Then enter double quotes in the custom formula tab to create a blank column for now. Name this column as "Group Id":

Image 7: Group Id column definition

This will result in a blank column named "Group Id" is displayed in the image below:

Image 8: Blank Group ID column added
  1. We will now perform basic transformations, such as changing data types and reordering columns, as shown in the image below:

Image 9: Basic Transformations
  1. Now, we will create a static table to define the groups in the visual.

    1. Click on "Enter Data" in the Home tab of Power Query Editor and input the data - Enter Data Directly | Power BI

    2. Enter the same values in both the Group Id and Id columns which we got in Subtree Id during transformation.

    3. Now, add the Group Names to the Title column to create a suitable structure for swim lanes, leaving the remaining columns blank.

  • After entering the data, we will append both queries. Ensure that the structure and column names in the static table match those in the source table.

  • You can choose to maintain this table in any data source of your choice and connect to the report

Image 10: Static Table of Groups
  1. Finally, we will append the Static Groups table to the Source table - Append Queries | Power Query

Image 11: Appending Static Table to the Source Table

Our data structure is now ready!

Image 12: Data Structure suitable for Swim Lanes

Finally, populate the data columns in the visual to display the data in swim lanes, as shown in the image below:

Image 13: Column Group (Swim lane) View in xViz Performance Flow | Power BI

Sample Report File - Columnar Group View

Refer to the documentation link below for details on the group structure, which allows multiple nodes to be displayed side by side within a single group - Data Structure for Wide Group Views

Last updated

Was this helpful?