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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Transposing Data

Hi All, 

 

I have seen other posts regarding transposing rows and columns, but none that match my specific circumstance. The current structure of my data table is as such:

Column 1Column 2Column 3Column 4Column 5Column 6
nullRETAILER IDA111A222A333A444
nullPROD. CODE0123123423453456
nullDESCRIPTIONABCBCDCDEDEF
BELGIUMJan 20230184
BELGIUMFeb 20231415
FRANCEJan 2023261720


I need to make the transpositions to achieve a format like this:

CountryDateRetailer IDProd. CodeDescriptionValue
BELGIUMJAN 2023A1110123ABC0
BELGIUMFEB 2023A1110123ABC1
FRANCEJAN 2023A1110123ABC2

 

And so on. 

Any help would be greatly appreciated. 

1 ACCEPTED SOLUTION

I also shortened the steps (optimized, not much)

 

View solution in original post

11 REPLIES 11
Ahmedx
Super User
Super User

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Screenshot_3.png

I also shortened the steps (optimized, not much)

 

Anonymous
Not applicable

This is fantastic. Thank you!!

Brunner_BI
Super User
Super User

I guess it depends on if you really ONLY have 3 rows with Column 1 as NULL or it is more than that, but you can do the following.

Create a second query referencing the old query, taking only the part of the table that has Column 1 as null and transposing that.

Then do various transformations in the first query

As a last step, create a new query "append as new query" and append the two tables, make sure here that your column names match (you can adjust them manually)

 

Maybe this gives you what you need to figure it out.

My point is that the structure of your rows are so inherently different that i would separate them completely, transform it so it will fit together somehow and then as a last step actually append them (put them back together)

------------------------------------
Brunner BI focusing on Microsoft Power BI development and consulting
Developers of external tool "Measure Killer"
My blog
Anonymous
Not applicable

Thank you. Yes, those 3 null values are the only ones in thet column. I think this is similar to what @Greg_Deckler proposed (which is getting me closer but not completely to the solution). 

Further, what I shared is a transformation of an original raw data source in an even more unworkable format. 

Greg_Deckler
Community Champion
Community Champion

@Anonymous Not 100% that this is what you want but see if the attached PBIX takes care of this.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Not quite. The next step would be to unpivot Column 3 thru Column 6 in Table 3 of your file. However, it does not produce the desired result as Prod Code 0123 should have monthly sales of 0, 1, and 2. 

@Anonymous So what would the final result look like fully from the example given?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Anonymous So what would the final result look like fully from the example given?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

The issue stems from this: the first 3 rows have a unique structure where the first column is null, the second column is really a column header, and then each remaining column has 1st row Retailer ID, 2nd row Prod Code, 3rd row Product Description with all rows underneath representing the quantity sold for that unique item at the specified country and date in columns 1 and 2. 

Anonymous
Not applicable

Something like this (using the PBI sample you provided). 

msylv13_0-1698260084678.png

However the value portion is incorrect based off the sample data. The entries for prod code 123 should look like:

msylv13_1-1698260315360.png

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors