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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.