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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
mrichman
Regular Visitor

How to create dynamic columns within Pivot - PowerBI?

Hi Community, 

 

Hope you're doing well. Is there any way to create a dynamic column in pivot? I want to rearrage the order... 

Instead of ABC I want to change the order for example to CBA, BAC or any order I would prefer. Thanks in advance!

 

mrichman_0-1637179904335.png

 

 

 

1 ACCEPTED SOLUTION
DataZoe
Microsoft Employee
Microsoft Employee

@mrichman You can change the order by changing the default sort order of the column used for A, B, C. One way I do it is to create a lookup/dimesnion table with a different specified ordering.

 

One way is to:

1. Go to "Modeling" ribbon, choose "New Table"

2. Enter this DAX expression:

Letters =
DATATABLE("Letter",STRING,"Sort Order",INTEGER,
{
{"A",3},
{"B",2},
{"C",1}
}
)
 
3. Click on the newly created [Letter] column in 'Letters' table, and in "Column Tools" ribbon choose "Sort by Column", and pick [Sort Order].
4. Join Letters[Letter] to Table[Letter] via relationship in modeling view
5. Now use the new Letters[Letter] in your matrix.
DataZoe_0-1637186855890.png

I've attached the PBIX too.

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

View solution in original post

2 REPLIES 2
DataZoe
Microsoft Employee
Microsoft Employee

@mrichman You can change the order by changing the default sort order of the column used for A, B, C. One way I do it is to create a lookup/dimesnion table with a different specified ordering.

 

One way is to:

1. Go to "Modeling" ribbon, choose "New Table"

2. Enter this DAX expression:

Letters =
DATATABLE("Letter",STRING,"Sort Order",INTEGER,
{
{"A",3},
{"B",2},
{"C",1}
}
)
 
3. Click on the newly created [Letter] column in 'Letters' table, and in "Column Tools" ribbon choose "Sort by Column", and pick [Sort Order].
4. Join Letters[Letter] to Table[Letter] via relationship in modeling view
5. Now use the new Letters[Letter] in your matrix.
DataZoe_0-1637186855890.png

I've attached the PBIX too.

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

@DataZoe Thanks for the help!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors