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

Transposing data into a more readable format

Hi,

 

I need some help converting the raw data in the attached to a more readible format.  The raw data and he expected results are in the attachment.

 

Raw Data:

Fund NameSub Fund NameISINLaunch dateLifecycleAE StatusAEAR StatusARAT StatusATBE StatusBE
ABCXYZLU000000011130/06/2011LaunchedDe-Registered28/02/2020Registered01/01/2018  Fiscal Certification only01/01/2015

 

Expected Outcome:

Fund NameSub Fund NameISINLaunch dateLifecycleISO CountryRegistration StatusRegistration Date
ABCXYZLU000000011130/06/2011LaunchedAEDe-Registered28/02/2020
ABCXYZLU000000011130/06/2011LaunchedARRegistered01/01/2018
ABCXYZLU000000011130/06/2011LaunchedAT  
ABCXYZLU000000011130/06/2011LaunchedBEFiscal Certification only01/01/2015

 

Fund NameSub Fund NameISINClassCurrencyLaunch dateLifecycleAE StatusAEAR StatusARAT StatusATBE StatusBE

 

I have tried the unpivot on the country columns but i am not able to get it into the format that i require. 

 

Any help would be appreciated.

 

Thanks in advance!

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

This M code works

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnRyVtJRioiMApI+oQYQYGhoCOR6ArFraBCQNDbQNTDTNTIAC/skluYlZ6SmAJkuqbpBqemZxSWpRWC+kYWugRFQnZEBkIMiY2CoC0RAEyyAHAhyyyxOTsxRcE4tKslMy0xOLMnMz1PIz8upRFZuqhQbCwA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Fund Name" = _t, #"Sub Fund Name" = _t, ISIN = _t, Class = _t, Currency = _t, #"Launch date" = _t, Lifecycle = _t, #"AE Status" = _t, AE = _t, #"AR Status" = _t, AR = _t, #"AT Status" = _t, AT = _t, #"BE Status" = _t, BE = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Fund Name", type text}, {"Sub Fund Name", type text}, {"ISIN", type text}, {"Class", type text}, {"Currency", type text}, {"Launch date", type date}, {"Lifecycle", type text}, {"AE Status", type text}, {"AE", type date}, {"AR Status", type text}, {"AR", type date}, {"AT Status", type text}, {"AT", type text}, {"BE Status", type text}, {"BE", type date}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Fund Name", "Sub Fund Name", "ISIN", "Class", "Currency", "Launch date", "Lifecycle"}, "Attribute", "Value"),
    #"Added Custom" = Table.AddColumn(#"Unpivoted Other Columns", "ISO Country", each if Text.End([Attribute],6) = "Status" then Text.Start([Attribute],2) else null),
    #"Filled Down" = Table.FillDown(#"Added Custom",{"ISO Country"}),
    #"Added Custom1" = Table.AddColumn(#"Filled Down", "Registration Status", each if Text.End([Attribute],6) = "Status" then [Value] else null),
    #"Filled Down1" = Table.FillDown(#"Added Custom1",{"Registration Status"}),
    #"Added Custom2" = Table.AddColumn(#"Filled Down1", "Registration Date", each if Text.End([Attribute],6) <> "Status" then [Value] else null),
    #"Filled Up" = Table.FillUp(#"Added Custom2",{"Registration Date"}),
    #"Removed Columns" = Table.RemoveColumns(#"Filled Up",{"Attribute", "Value"}),
    #"Removed Duplicates" = Table.Distinct(#"Removed Columns")
in
    #"Removed Duplicates"

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

5 REPLIES 5
Malsk1_1
Helper II
Helper II

@Ashish_Mathur  thank you - this worked i was able to follow the M Code and managed to get the desired output!!

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

This M code works

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnRyVtJRioiMApI+oQYQYGhoCOR6ArFraBCQNDbQNTDTNTIAC/skluYlZ6SmAJkuqbpBqemZxSWpRWC+kYWugRFQnZEBkIMiY2CoC0RAEyyAHAhyyyxOTsxRcE4tKslMy0xOLMnMz1PIz8upRFZuqhQbCwA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Fund Name" = _t, #"Sub Fund Name" = _t, ISIN = _t, Class = _t, Currency = _t, #"Launch date" = _t, Lifecycle = _t, #"AE Status" = _t, AE = _t, #"AR Status" = _t, AR = _t, #"AT Status" = _t, AT = _t, #"BE Status" = _t, BE = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Fund Name", type text}, {"Sub Fund Name", type text}, {"ISIN", type text}, {"Class", type text}, {"Currency", type text}, {"Launch date", type date}, {"Lifecycle", type text}, {"AE Status", type text}, {"AE", type date}, {"AR Status", type text}, {"AR", type date}, {"AT Status", type text}, {"AT", type text}, {"BE Status", type text}, {"BE", type date}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Fund Name", "Sub Fund Name", "ISIN", "Class", "Currency", "Launch date", "Lifecycle"}, "Attribute", "Value"),
    #"Added Custom" = Table.AddColumn(#"Unpivoted Other Columns", "ISO Country", each if Text.End([Attribute],6) = "Status" then Text.Start([Attribute],2) else null),
    #"Filled Down" = Table.FillDown(#"Added Custom",{"ISO Country"}),
    #"Added Custom1" = Table.AddColumn(#"Filled Down", "Registration Status", each if Text.End([Attribute],6) = "Status" then [Value] else null),
    #"Filled Down1" = Table.FillDown(#"Added Custom1",{"Registration Status"}),
    #"Added Custom2" = Table.AddColumn(#"Filled Down1", "Registration Date", each if Text.End([Attribute],6) <> "Status" then [Value] else null),
    #"Filled Up" = Table.FillUp(#"Added Custom2",{"Registration Date"}),
    #"Removed Columns" = Table.RemoveColumns(#"Filled Up",{"Attribute", "Value"}),
    #"Removed Duplicates" = Table.Distinct(#"Removed Columns")
in
    #"Removed Duplicates"

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur are you able to send me the pbix? that way i can also follow the steps you have done in query editor.

 

In reality i have more columns than i had in the example above.. so i will need to tweak the code for the additional columns

Malsk1_1
Helper II
Helper II

Data now attached.

Transpose Data Example 

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.