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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
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.