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
Anonymous
Not applicable

*DAX QUERY - Converting a row into columns and columns into a row using DAX*

 Hi, 

 

I am trying to Transpose data using DAX rather than the power query method but finding it tricky to convert a single row into multiple columns whilst turning several columns into rows. 

 

As an example my table is as follows

 

LocationABCDE
City112345
City2678910
City31112131415
City41617181920

 

I would like to convert it to 

 

 City1City2City3City4
A161116
B271217
C381318
D491419
E5101520

 

I managed to convert the columns into rows using the UNION and SELECTCOLUMNS but don't know how to transpose the location field into columns. 

 

The formula I have used so far is as follows

 

NewTable = 

UNION (
SELECTCOLUMNS (
'[Table1]',
"Location",'Table1'[Location],
"NewColumnName", "[A]",
"Value", 'Tavble1'[A]

),

SELECTCOLUMNS (
'[Table1]',
"Location",'Table1'[Location],
"NewColumnName", "[B]",
"Value", 'Tavble1'[B]

))

 

Any help would be appreciated.

1 REPLY 1

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.