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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
JustinDoh1
Post Prodigy
Post Prodigy

Reorder columns for Matrix visualization (with sort order data provided from the same table)

I am trying to reorder the column order for a Matrix visualization.

So, I am trying to have "Medicare A" (ReportColumnOrder = 1) as displayed far left, then after "Medicate HMO"

(ReportColumnOrder = 2) would be next left to "Medicare A" etc.

 

Bottom is screenshot.

JustinDoh1_3-1622850742357.png

 

I already prepared a dataset that has the data of sort order ("1,2,3..9") matching with "PayerNameRedefined" column shown below:

JustinDoh1_1-1622850023638.png

JustinDoh1_2-1622850160026.png

 

I searched online, and I found a solution that is adding a query (using M language), but this case is not using column name.

I also found another solution somewhat similar, but this one is not with Matrix visualization and sorting works in visualization part when sorting was performed at Data view level. 

 

Given that I have a data that already provides the order (1...9), would it be a somewhat simple approach?

BTW, this particular column ("ReportColumnOrder") that has the sort order is not displayed on the Matrix visualization.

 

Is it possible to somehow insert this column ("ReportColumnOrder") as hidden and sort the column that way? 

 

I am guessing I would probably need to write a M language inside Power Query.

 

(I am trying to make this sort order as dynamic as possible for all other similar reports without having to insert extra code in Power BI).

 

Thanks for help!  

 

 

 

 

 

 

3 ACCEPTED SOLUTIONS
mahoneypat
Microsoft Employee
Microsoft Employee

Please see this page for how to do this using the Sort By Column feature in Power BI.

Sort by column in Power BI Desktop - Power BI | Microsoft Docs

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

v-yingjl
Community Support
Community Support

Hi @JustinDoh1 ,

Select the [PayerNameDefined] column, use 'Sort by column' feature in Columns tools and sort the column by the [ReportColumnOrder] column, you will get the result.

Capture.PNG

 

Best Regards,
Community Support Team _ Yingjie Li
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

@v-yingjl Thank you. I was thinking in a harder way. When I searched thru Google, there were so many other solutions related to similar cases, so I thought I have to solve in Power Query (M language).  Also, there was some error on SQL side, so I had to fix it.

View solution in original post

4 REPLIES 4
v-yingjl
Community Support
Community Support

Hi @JustinDoh1 ,

Select the [PayerNameDefined] column, use 'Sort by column' feature in Columns tools and sort the column by the [ReportColumnOrder] column, you will get the result.

Capture.PNG

 

Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I tried this, but the columns are still not sorting horizontally. 

@v-yingjl Thank you. I was thinking in a harder way. When I searched thru Google, there were so many other solutions related to similar cases, so I thought I have to solve in Power Query (M language).  Also, there was some error on SQL side, so I had to fix it.

mahoneypat
Microsoft Employee
Microsoft Employee

Please see this page for how to do this using the Sort By Column feature in Power BI.

Sort by column in Power BI Desktop - Power BI | Microsoft Docs

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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

Top Solution Authors
Top Kudoed Authors