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
some1else
Helper II
Helper II

Transpose using DAX and virtual table

Hi guys.

 

If I were to transpose columns into rows like the image below, how could I achieve it using a virtual table in a measure? I don't want to create a copy of the existing table and store it in the model.

 

From my understanding this should be possible using UNION, SELECTCOLUMNS or maybe SUMMARIZE, but I'm struggling to get them right.

 

Thanks in advance.transpose.jpg

1 ACCEPTED SOLUTION
v-angzheng-msft
Community Support
Community Support

Hi, @some1else 

The easiest way to get the results you want is to transpose them in the Query Editor.

Sample data:

v-angzheng-msft_0-1617875066082.jpeg

Step 1: Use Headers as First Row

Step 2: Transpose

v-angzheng-msft_1-1617875066085.jpeg

Result:

v-angzheng-msft_2-1617875066087.jpeg

 

 

Is this the result you want? Hope this is useful to you

Please feel free to let me know If you have further questions

 

 

Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-angzheng-msft
Community Support
Community Support

Hi, @some1else 

The easiest way to get the results you want is to transpose them in the Query Editor.

Sample data:

v-angzheng-msft_0-1617875066082.jpeg

Step 1: Use Headers as First Row

Step 2: Transpose

v-angzheng-msft_1-1617875066085.jpeg

Result:

v-angzheng-msft_2-1617875066087.jpeg

 

 

Is this the result you want? Hope this is useful to you

Please feel free to let me know If you have further questions

 

 

Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

MattAllington
Community Champion
Community Champion

The bigger question is why you have the first table in the model. The first table does not look like a structure that is well suited to PBI. Does the table really have just 2 rows?  Consider transposing the first table and loading it once in the transposed state. You can do this in power query

1. Use headers as first row

2. Transpose

3. Rename the first column "header"

3. Unpivot the 3 column table into 2 columns


this should give you 3 new columns (header, attribute, value). 

from there you can use a matrix with header on rows, attribute on column, and value in the values section. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.
selimovd
Super User
Super User

Hey @some1else ,

 

a close approach is the following table:

UNION (
    SELECTCOLUMNS ( myTable, "ID", "A", "Value", [A] ),
    SELECTCOLUMNS ( myTable, "ID", "B", "Value", [B] ),
    SELECTCOLUMNS ( myTable, "ID", "C", "Value", [C] ),
    SELECTCOLUMNS ( myTable, "ID", "D", "Value", [D] )
)

 

Check if that would work, that's more or less a unpivot of the table.

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Feeling very dumb right now...

 

Tried that but no sucess as it gives an error expecting one value only (tried with a measure, because I don't want to physically create columns or new tables).

Below image with the error and image with table OTs with the columns currently on it.

 

The idea is to have the WONUM and ZMC in row and the values in columns

 

error1.jpg

 

error2.jpg

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.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.