Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
MOOREJEFFREY
Frequent Visitor

SORT X AXIS BY 2 DIMENSIONS

Hello, Is it possible to sort the X axis by two dimensions? In my case I would like to sort the X axis by duration ( as shown ) then by day ( to estimate trend ). If the source data is sorted in this way, it does not translate to the report object. The legend is sorted correctly but not the X axis. Thank you for your help and time.sample report.JPG

1 ACCEPTED SOLUTION
v-zhengdxu-msft
Community Support
Community Support

Hi @MOOREJEFFREY 

 

I've got your question: you want to sort the stacked bar chart by duration then by day.

However, the Stacked bar chart still does not support multi-dimensional sorting now, it is not possible to use both sorting methods at the same time

 

Maybe you can try this custom sorting:

First, I created a set of sample data:

vzhengdxumsft_0-1705902495749.pngvzhengdxumsft_1-1705902495749.png

Then I copied the day column, clicked Enter Data to paste it in, and created a new column to use as a sort marker:

vzhengdxumsft_2-1705902507401.png

Click Transform data > Merge Queries

vzhengdxumsft_3-1705902507403.pngvzhengdxumsft_4-1705902515384.png

Apply & Close

Column tools > (select the day column) Sort by column > Table (3).sort

vzhengdxumsft_5-1705902515387.png

The result is as follow:

vzhengdxumsft_6-1705902524714.png

Or you can try R script and create your own stacked bar chart with both sorting methods, these documents may help you:

Run R scripts in Power BI Desktop - Power BI | Microsoft Learn

Create Power BI visuals using R - Power BI | Microsoft Learn

Learn which R packages are supported - Power BI | Microsoft Learn

 

Best Regards,

Zhengdong Xu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-zhengdxu-msft
Community Support
Community Support

Hi @MOOREJEFFREY 

 

I've got your question: you want to sort the stacked bar chart by duration then by day.

However, the Stacked bar chart still does not support multi-dimensional sorting now, it is not possible to use both sorting methods at the same time

 

Maybe you can try this custom sorting:

First, I created a set of sample data:

vzhengdxumsft_0-1705902495749.pngvzhengdxumsft_1-1705902495749.png

Then I copied the day column, clicked Enter Data to paste it in, and created a new column to use as a sort marker:

vzhengdxumsft_2-1705902507401.png

Click Transform data > Merge Queries

vzhengdxumsft_3-1705902507403.pngvzhengdxumsft_4-1705902515384.png

Apply & Close

Column tools > (select the day column) Sort by column > Table (3).sort

vzhengdxumsft_5-1705902515387.png

The result is as follow:

vzhengdxumsft_6-1705902524714.png

Or you can try R script and create your own stacked bar chart with both sorting methods, these documents may help you:

Run R scripts in Power BI Desktop - Power BI | Microsoft Learn

Create Power BI visuals using R - Power BI | Microsoft Learn

Learn which R packages are supported - Power BI | Microsoft Learn

 

Best Regards,

Zhengdong Xu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

Please graphically indicate the expected outcome.

Hello Ibendlin, Thank you for the response. Please see the image attached. Hopefully this helps.

sample report 2.JPG

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.