Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello Everyone,
I have an excel data set in the below format. But I want to convert the same in the expected format below as well. Is there a way to achieve this in Power BI transformation.
Personal Account | |
Phones | Category |
Iphone6 | No Demand |
Iphone7 | Demand |
Iphone8 | Demand |
Iphone9 | No Demand |
Iphone10 | Demand |
Iphone11 | Demand |
Public Account | |
Phones | Category |
Iphone6 | No Demand |
Iphone7 | Demand |
Iphone8 | Demand |
Iphone9 | No Demand |
Iphone10 | Demand |
Iphone11 | Demand |
Expected Result | |
Phones - Personal Account | Category |
Iphone6 - Personal Account | No Demand |
Iphone7 - Personal Account | Demand |
Iphone8 - Personal Account | Demand |
Iphone9 - Personal Account | No Demand |
Iphone10 - Personal Account | Demand |
Iphone11 - Personal Account | Demand |
Phones - Public Account | Category |
Iphone6 - Public Account | No Demand |
Iphone7 - Public Account | Demand |
Iphone8 - Public Account | Demand |
Iphone9 - Public Account | No Demand |
Iphone10 - Public Account | Demand |
Iphone11 - Public Account | Demand |
Solved! Go to Solution.
In PowerQuery you can add a custom column that checks if column 2 is blank and if so get the value from column 1 then to a fill down.
Start
Add custom column
fill down
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCkgtKs7PS8xRcExOzi/NK1HSUVJQitUBSmTk56UWA7nOiSWp6flFlWBRzwKQsBlQ2C9fwSU1NzEvBUncHCiOIWiBTdAShwmGBthUGxqiigaUJuVkJg8dJ8cCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom.1", each if Text.Length(Text.Trim([Column2])) = 0 then [Column1] else null),
#"Filled Down" = Table.FillDown(#"Added Custom",{"Custom.1"})
in
#"Filled Down"
This is the code for the custom column.
if Text.Length(Text.Trim([Column2])) = 0 then [Column1] else null
In PowerQuery you can add a custom column that checks if column 2 is blank and if so get the value from column 1 then to a fill down.
Start
Add custom column
fill down
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCkgtKs7PS8xRcExOzi/NK1HSUVJQitUBSmTk56UWA7nOiSWp6flFlWBRzwKQsBlQ2C9fwSU1NzEvBUncHCiOIWiBTdAShwmGBthUGxqiigaUJuVkJg8dJ8cCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom.1", each if Text.Length(Text.Trim([Column2])) = 0 then [Column1] else null),
#"Filled Down" = Table.FillDown(#"Added Custom",{"Custom.1"})
in
#"Filled Down"
This is the code for the custom column.
if Text.Length(Text.Trim([Column2])) = 0 then [Column1] else null
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
72 | |
70 | |
37 | |
29 | |
26 |
User | Count |
---|---|
91 | |
49 | |
45 | |
38 | |
37 |