The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Estoy buscando crear una columna de "clave" con los únicos nombres y valores de columna para aquellos que no son nulos.
Un ejemplo es...
| Un | B | C | ->>> | | clave
| 1 | | nulo 3 | ->>> "A=1,C=3"
| | nulo 2 | | nulo ->>> "B=2"
| 2 | 4 | 5 | ->>> "A=2,B=4,C=5"
¿Hay alguna forma de extraer solo nombres de columna donde el valor no es nulo y crear una columna clave como la anterior?
HI @spencerhoyle ,
En mi opinión, debe crear tres columnas, luego combinar:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUQKhWJ1oEG2ExAYiYzDbECoB5MUCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [a = _t, b = _t, c = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"a", Int64.Type}, {"b", Int64.Type}, {"c", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom1", each if [a] is null and [b] is null then ""
else if [a] <>null and [b] is null then "a="&Number.ToText([a]) else "a="&Number.ToText([a])&","),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom2", each if [b] is null and [c] is null then ""
else if [b] <>null and [c] is null then "b="&Number.ToText([b]) else "b="&Number.ToText([b])&","),
#"Added Custom2" = Table.AddColumn(#"Added Custom1", "Custom3", each if [c] is null then "" else "c="&Number.ToText([c])),
#"Added Custom3" = Table.AddColumn(#"Added Custom2", "Final", each [Custom1]&[Custom2]&[Custom3]),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom3",{"Custom1", "Custom2", "Custom3"})
in
#"Removed Columns"
Si esta publicación ayuda, considere Aceptarla como la solución para ayudar a los otros miembros a encontrarla más rápidamente.
Saludos
Lucien
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.