Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I have original data like bellow:
May I know how to transform to bellow format?
Actually, my final purpose is create a report(refer bellow picture) base on the data.
Solved! Go to Solution.
Hi @QZ ,
Please try below M Code:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtY31DdU0lFyS0wuyS+qVACxfROTMzLzUkFMQz0IaQQmjZVidQjpAqk0Ausy0oOwidFlDGQag3UZg3UZo+oywudCEzBpCibNiNAFcZUJmDQFk8TogrjQBEyagkmgrlgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Process Date" = _t, Area = _t, Machine = _t, EOP1 = _t, EOP2 = _t, EOP3 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Process Date", type date}, {"Area", type text}, {"Machine", type text}, {"EOP1", type number}, {"EOP2", type number}, {"EOP3", type number}}),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Process Date", "Area", "Machine"}, "Attribute", "Value"),
#"Pivoted Column" = Table.Pivot(#"Unpivoted Columns", List.Distinct(#"Unpivoted Columns"[Machine]), "Machine", "Value"),
#"Renamed Columns" = Table.RenameColumns(#"Pivoted Column",{{"Attribute", "Period"}})
in
#"Renamed Columns"
If this helps then mark it as a solution.
Thank you.
Sample output:
It's works, thanks!👍
Hi @QZ ,
Please try below M Code:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtY31DdU0lFyS0wuyS+qVACxfROTMzLzUkFMQz0IaQQmjZVidQjpAqk0Ausy0oOwidFlDGQag3UZg3UZo+oywudCEzBpCibNiNAFcZUJmDQFk8TogrjQBEyagkmgrlgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Process Date" = _t, Area = _t, Machine = _t, EOP1 = _t, EOP2 = _t, EOP3 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Process Date", type date}, {"Area", type text}, {"Machine", type text}, {"EOP1", type number}, {"EOP2", type number}, {"EOP3", type number}}),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Process Date", "Area", "Machine"}, "Attribute", "Value"),
#"Pivoted Column" = Table.Pivot(#"Unpivoted Columns", List.Distinct(#"Unpivoted Columns"[Machine]), "Machine", "Value"),
#"Renamed Columns" = Table.RenameColumns(#"Pivoted Column",{{"Attribute", "Period"}})
in
#"Renamed Columns"
If this helps then mark it as a solution.
Thank you.
Sample output:
Hi @QZ ,
You can do this with Unpivot option in Power Query.
Try this and let me know if you have any queries.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
12 | |
8 | |
8 | |
7 |
User | Count |
---|---|
15 | |
13 | |
7 | |
7 | |
6 |