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

Top Solution Authors