September 19, 2023

PowerBI: How to reorder a Legend

I share here a learning about how to reorder a Legend in a PowerBI Chart.

Problem description

I wanted to create a chart displaying Jira issues along their statuses.
The Order of the Statuses shall not be alphabetical but rather follow the logical workflow - see image below.

Solution

Create a New Table

In Transform Data→ Enter Data


Enter the table that defines the sorting.

Create a Relationship

Go to Report View→ Modeling→ Manage Relationships



PowerBI will auto-intelligently propose you a default relationship:


Edit Cross filter direction = Both

Add Custom Column 

Using the DAX Formula

Custom SortStatus = RELATED(SortStatus[Order])

If the previous Table name is "SortStatus" and order the second column

Sort by Custom Column

Reference

No comments:

Post a Comment