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
andyor
Resolver I
Resolver I

Changing sort order of column in pivoted Matrix- revisited

How can one change the sort order of a Pivoted column like this in a Matrix?

 

I can change the sort order of the column in Column Tools etc, but it doesn't update the order in the visual. I've also created a new rank column and tried to sort by that, but the column headers on the visual never change. I want 2023-4 to show first.  

 

andyor_0-1675473468351.png

 

To pivot my Matrix around the  [Year - WeekNumber] column , I have used the Switch Values to Rows option

 

 

andyor_1-1675473486556.png

 

 

Just noting that I put this question up previously and was given a link to this video. This does not work/help for my particular case - https://www.youtube.com/watch?v=KK1zu4MBb-c

 

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

Hi  @andyor ,

 

Here are the steps you can follow:

1. Enter data to create a table that satisfies the sorting in the matrix.

vyangliumsft_0-1675667743521.png

2. In Power Query -- Add Column – Index Column – From 1.

vyangliumsft_1-1675667743525.png

3. [year-month] -- [Column tools] – [Sort by column] – [lndex]

vyangliumsft_2-1675667743527.png

4. Connect the relationship between two tables through [year-month] of two tables.

vyangliumsft_3-1675667743528.png

5. Result:

The [year-month] of the RankTable is placed in the Column.

The [Group] of the Table is placed in the Rows.

The [Value] of the table is placed in the Values.

 

vyangliumsft_4-1675667743532.png

 

Best Regards,

Liu Yang

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

4 REPLIES 4
v-yangliu-msft
Community Support
Community Support

Hi  @andyor ,

 

Here are the steps you can follow:

1. Enter data to create a table that satisfies the sorting in the matrix.

vyangliumsft_0-1675667743521.png

2. In Power Query -- Add Column – Index Column – From 1.

vyangliumsft_1-1675667743525.png

3. [year-month] -- [Column tools] – [Sort by column] – [lndex]

vyangliumsft_2-1675667743527.png

4. Connect the relationship between two tables through [year-month] of two tables.

vyangliumsft_3-1675667743528.png

5. Result:

The [year-month] of the RankTable is placed in the Column.

The [Group] of the Table is placed in the Rows.

The [Value] of the table is placed in the Values.

 

vyangliumsft_4-1675667743532.png

 

Best Regards,

Liu Yang

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

andyor
Resolver I
Resolver I

Hi Amit

 

I can't follow what you're doing here. You have an extra table called Date. I have 1 table. Inside this table I have a TEXT type column named Year_Week, which is what is showing on my visual. 

 

It also doesn't show which table the values are coming from in the pbix file you had. They're hidden in some way? Do they have to come from the same table as Date, or do they have to come from another table?

 

I still also don't know how to switch the sort order to be opposite. You currently have 2020 - 9 show on the left. How do you reverse that? What are step 1, step 2, step 3 etc? What it shows on that youtube video didn't change the visual in any way for me. 

I was able to get this working after some more back and forth. It finally clicked with the youtube video that I had to create a new column that was = to the old column. Then sort by a normal RANKX and use that new column in the visual. You should have just said!! 😉 

 

No idea why this works with a new column that is = to the old. But it just does...

amitchandak
Super User
Super User

@andyor , refer to the file attached after signature

 

amitchandak_0-1675480655448.png

 

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.