The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hello,
I'd like to transform "list of records" into row e.g. Media 1, Media 2. See attached image. Any recommendation for the step by step or function? I really appreciate your help, thanks.
Solved! Go to Solution.
See the following M code, which you need to put in a blank query.
1) In Power Query, select New Source, then Blank Query
2) On the Home ribbon, select "Advanced Editor" button
3) Remove everything you see, then paste the M code I've given you in that box.
4) Press Done
let
Source = 0,
#"Converted to Table" = #table(1, {{Source}}),
#"Added Custom" = Table.AddColumn(#"Converted to Table", "Custom", each {[A = 1, B = 2],[A = 4, B = 8]}),
#"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"),
#"Expanded Custom1" = Table.ExpandRecordColumn(#"Expanded Custom", "Custom", {"A", "B"}, {"A", "B"}),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Expanded Custom1", {"Column1"}, "Attribute", "Value")
in
#"Unpivoted Other Columns"
Turns this:
Into this
Which I then expand and unpivot to get this:
If you need more... How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingSee the following M code, which you need to put in a blank query.
1) In Power Query, select New Source, then Blank Query
2) On the Home ribbon, select "Advanced Editor" button
3) Remove everything you see, then paste the M code I've given you in that box.
4) Press Done
let
Source = 0,
#"Converted to Table" = #table(1, {{Source}}),
#"Added Custom" = Table.AddColumn(#"Converted to Table", "Custom", each {[A = 1, B = 2],[A = 4, B = 8]}),
#"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"),
#"Expanded Custom1" = Table.ExpandRecordColumn(#"Expanded Custom", "Custom", {"A", "B"}, {"A", "B"}),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Expanded Custom1", {"Column1"}, "Attribute", "Value")
in
#"Unpivoted Other Columns"
Turns this:
Into this
Which I then expand and unpivot to get this:
If you need more... How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI Reporting