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
jayanthan
Helper III
Helper III

Transpose

Hi there

 

Below given sample data should be converted into  City and Date. Any Suggestions?

Data Table

CityQ1Q2Q3Q4
London1/1/20184/1/20186/30/20189/28/2018
Manchester 4/1/20186/30/20189/28/2018
Westham  6/30/20189/28/2018

 

Expected Outcome 

 

CityDate
London1/1/2018
London4/1/2018
London6/30/2018
London9/28/2018
Manchester4/1/2018
Manchester6/30/2018
Manchester9/28/2018
Westham6/30/2018
Westham9/28/2018

 

Regards

Jayanthan

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

Hi @jayanthan ,

You could implement it in Query Editor. I created a sample that you can follow  the steps.

1. Select the columns of Q1, Q2, Q3 and Q4 > unpivot columns.

2.PNG

2. Remove the column of Attribute. 

3.PNG

3.  Then you get the table that you want.

4.PNG

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8snPS8nPU9JRMtQ31DcyMLQAMk0QTDN9YwMY21LfyALCjtWJVvJNzEvOSC0uSS0CSikQqyscqCMjMReqRQG32lgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [City = _t, Q1 = _t, Q2 = _t, Q3 = _t, Q4 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"City", type text}, {"Q1", type date}, {"Q2", type date}, {"Q3", type date}, {"Q4", type date}}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"City"}, "Attribute", "Value"),
    #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Columns",{"Attribute"}),
    #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Value", "Date"}})
in
    #"Renamed Columns"

Best Regards,

Xue Ding

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Kudos are nice too.

Best Regards,
Xue Ding
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

3 REPLIES 3
Anonymous
Not applicable

Did you find a way to make it appear on power query editor @jayanthan? I created a new table from my source file using query with the hopes to transpose/ unpivot it later, but the table I created is not showing on my power query editor 😞 

v-xuding-msft
Community Support
Community Support

Hi @jayanthan ,

You could implement it in Query Editor. I created a sample that you can follow  the steps.

1. Select the columns of Q1, Q2, Q3 and Q4 > unpivot columns.

2.PNG

2. Remove the column of Attribute. 

3.PNG

3.  Then you get the table that you want.

4.PNG

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8snPS8nPU9JRMtQ31DcyMLQAMk0QTDN9YwMY21LfyALCjtWJVvJNzEvOSC0uSS0CSikQqyscqCMjMReqRQG32lgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [City = _t, Q1 = _t, Q2 = _t, Q3 = _t, Q4 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"City", type text}, {"Q1", type date}, {"Q2", type date}, {"Q3", type date}, {"Q4", type date}}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"City"}, "Attribute", "Value"),
    #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Columns",{"Attribute"}),
    #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Value", "Date"}})
in
    #"Renamed Columns"

Best Regards,

Xue Ding

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Kudos are nice too.

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-xuding-msft 

 

Thank you for the suggestion. However, I cannot use edit queries as those fields are from new custom columns, therefore they will not show in edit queries.

 

Regards

Jayanthan

 

 

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.