Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hola a todos,
Tengo un conjunto de datos de Excel en el siguiente formato. Pero quiero convertir lo mismo en el formato esperado a continuación también. ¿Hay alguna manera de lograr esto en la transformación de Power BI.
Cuenta personal | |
Teléfonos | Categoría |
Iphone6 | Sin demanda |
Iphone7 | Demanda |
Iphone8 | Demanda |
Iphone9 | Sin demanda |
Iphone10 | Demanda |
Iphone11 | Demanda |
Cuenta pública | |
Teléfonos | Categoría |
Iphone6 | Sin demanda |
Iphone7 | Demanda |
Iphone8 | Demanda |
Iphone9 | Sin demanda |
Iphone10 | Demanda |
Iphone11 | Demanda |
Resultado esperado | |
Teléfonos - Cuenta personal | Categoría |
Iphone6 - Cuenta personal | Sin demanda |
Iphone7 - Cuenta personal | Demanda |
Iphone8 - Cuenta personal | Demanda |
Iphone9 - Cuenta personal | Sin demanda |
Iphone10 - Cuenta personal | Demanda |
Iphone11 - Cuenta personal | Demanda |
Teléfonos - Cuenta Pública | Categoría |
Iphone6 - Cuenta Pública | Sin demanda |
Iphone7 - Cuenta Pública | Demanda |
Iphone8 - Cuenta Pública | Demanda |
Iphone9 - Cuenta Pública | Sin demanda |
Iphone10 - Cuenta Pública | Demanda |
Iphone11 - Cuenta Pública | Demanda |
Solved! Go to Solution.
En PowerQuery puede agregar una columna personalizada que compruebe si la columna 2 está en blanco y, si es así, obtener el valor de la columna 1, a continuación, a un relleno hacia abajo.
Empezar
Añadir columna personalizada
llenar hacia abajo
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"
Este es el código de la columna personalizada.
if Text.Length(Text.Trim([Column2])) = 0 then [Column1] else null
En PowerQuery puede agregar una columna personalizada que compruebe si la columna 2 está en blanco y, si es así, obtener el valor de la columna 1, a continuación, a un relleno hacia abajo.
Empezar
Añadir columna personalizada
llenar hacia abajo
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"
Este es el código de la columna personalizada.
if Text.Length(Text.Trim([Column2])) = 0 then [Column1] else null
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.