Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Lobs
Helper II
Helper II

Transformación de datos sin procesar

Hola

Se me dio un conjunto de datos sin procesar que necesito volver a organizar, para poder hacer un mejor uso de ellos en Power BI.

Los datos sin procesar se ven así

ClienteCampusProgramaDpeClúster NOV 1 6PMNOV 1 8PMNOV 1 10PMNOV 1 11PMNOV 2 1AMNOV 2 3 AMNOV 2 4AMNOV 2 6AMNOV 2 8AMNOV 2 10AMNOV 2 12PM
AlfaPaGuayabaKenA
BetaGaCerezaRyuA

¿Hay alguna manera de mover esos intervalos de noviembre a una sola columna cuando im en Power Query?

Esperaba obtener este resultado para poder administrarlo mejor en BI

ClienteCampusProgramaDpeClúster IntervaloAR%
AlfaPaGuayabaKenANOV 1 6PM
AlfaPaGuayabaKenANOV 1 8PM
AlfaPaGuayabaKenANOV 1 10PM
AlfaPaGuayabaKenANOV 1 11PM
AlfaPaGuayabaKenANOV 2 1AM
AlfaPaGuayabaKenANOV 2 3 AM
AlfaPaGuayabaKenANOV 2 4AM

2 ACCEPTED SOLUTIONS
Fowmy
Super User
Super User

@Lobs

En Power Query, puede seleccionar todas las columnas desde Cliente hasta Clúster y hacer clic con el botón derecho, seleccionar Despivot Otras columnas, se mostrará el diseño deseado.

Pegue el siguiente código en Consulta en blanco y compruebe

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcswpyEhU0lEKcAQS7qWJZSCOd2oekASJEECxOtFKTqklID3uIOXOGalFRZVARlBlKZEmxAIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Client = _t, Campus = _t, Program = _t, DPE = _t, #"CLUSTER " = _t, #"NOV 1 6PM" = _t, #"NOV 1 8PM" = _t, #"NOV 1 10PM" = _t, #"NOV 1 11PM" = _t, #"NOV 2 1AM" = _t, #"01-11-02 3:00" = _t, #"NOV 2 4AM" = _t, #"NOV 2 6AM" = _t, #"NOV 2 8AM" = _t, #"NOV 2 10AM" = _t, #"NOV 2 12PM" = _t]),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Client", "Campus", "Program", "DPE", "CLUSTER "}, "Attribute", "Value")
in
    #"Unpivoted Other Columns"

________________________

Si mi respuesta fue útil, considere Aceptarla como la solución para ayudar a los otros miembros a encontrarla

Haga clic en el icono Thumbs-Up si le gusta esta respuesta 🙂

Youtube Linkedin

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

Supongo que estás viendo en blanco porque no tienes datos

No estoy seguro de si desea espacios en blanco en la salida final, pero se puede tratar así

let
    Source = Excel.Workbook(File.Contents("C:\Users\...\Sample.xlsx"), null, true),
    Sheet2_Sheet = Source{[Item="Sheet2",Kind="Sheet"]}[Data],
    #"Promoted Headers" = Table.PromoteHeaders(Sheet2_Sheet, [PromoteAllScalars=true]),
    #"Replaced Value" = Table.ReplaceValue(#"Promoted Headers",null,"zzz",Replacer.ReplaceValue,{"NOV 1 6PM", "NOV 1 8PM", "NOV 1 10PM", "NOV 1 11PM", "NOV 2 1AM", "NOV 2 3 AM", "NOV 2 4AM", "NOV 2 6AM", "NOV 2 8AM", "NOV 2 10AM", "NOV 2 12PM"}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Replaced Value", {"Client", "Campus", "Program", "DPE", "CLUSTER "}, "Attribute", "Value"),
    #"Replaced Value1" = Table.ReplaceValue(#"Unpivoted Other Columns","zzz","",Replacer.ReplaceText,{"Value"})
in
    #"Replaced Value1"

usted ve la salida como

sevenhills_0-1604186686947.png

View solution in original post

8 REPLIES 8
Fowmy
Super User
Super User

@Lobs

En Power Query, puede seleccionar todas las columnas desde Cliente hasta Clúster y hacer clic con el botón derecho, seleccionar Despivot Otras columnas, se mostrará el diseño deseado.

Pegue el siguiente código en Consulta en blanco y compruebe

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcswpyEhU0lEKcAQS7qWJZSCOd2oekASJEECxOtFKTqklID3uIOXOGalFRZVARlBlKZEmxAIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Client = _t, Campus = _t, Program = _t, DPE = _t, #"CLUSTER " = _t, #"NOV 1 6PM" = _t, #"NOV 1 8PM" = _t, #"NOV 1 10PM" = _t, #"NOV 1 11PM" = _t, #"NOV 2 1AM" = _t, #"01-11-02 3:00" = _t, #"NOV 2 4AM" = _t, #"NOV 2 6AM" = _t, #"NOV 2 8AM" = _t, #"NOV 2 10AM" = _t, #"NOV 2 12PM" = _t]),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Client", "Campus", "Program", "DPE", "CLUSTER "}, "Attribute", "Value")
in
    #"Unpivoted Other Columns"

________________________

Si mi respuesta fue útil, considere Aceptarla como la solución para ayudar a los otros miembros a encontrarla

Haga clic en el icono Thumbs-Up si le gusta esta respuesta 🙂

Youtube Linkedin

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Hola Gracias por la respuesta rápida, el código funcionó, pero cuando lo probé en mi archivo real, la tabla se convirtió en vacía.

Lobs_0-1604175328757.png

¿Me perdí un código?

@Lobs

Haga clic en la flecha hacia abajo de cualquier columna y haga clic en Ascendente , debería ver los datos, es una especie de error.

________________________

Si mi respuesta fue útil, considere Aceptarla como la solución para ayudar a los otros miembros a encontrarla

Haga clic en el icono Thumbs-Up si le gusta esta respuesta 🙂

Youtube Linkedin

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Todavía en blanco,

Esto es lo que tengo en el editor de avanzada,

Dejar
Origen: SharePoint.Tables("sharepoint.com/", [ApiVersion n.o 15]),
"ee76b69f-b713-40b3-3231-67e7b609a49f" ? Fuente -[Id"ee76b69f-b713-40b3-3231-67e7b609a49f"]-[Items],
"Columnas renombradas" - Table.RenameColumns('ee76b69f-b713-40b3-b98b-67e7b609a49f",'ID", "ID.1"'),
"Columnas eliminadas" - Table.RemoveColumns("Renamed Columns","FileSystemObjectType", "Id", "ServerRedirectedEmbedUri", "ServerRedirectedEmbedUrl", "Title", "ContentTypeId", "ComplianceAssetId", "ID.1", "Modified", "Created", "AuthorId", "EditorId", "OData__UIVersionString", "Attachments", "GUID", "FirstUniqueAncestorSecurableObject", "RoleAssignments", "AttachmentFiles", "ContentType", "GetDlpPolicyTip", "FieldValuesAsHtml", "FieldValuesAsText", "FieldValuesForEdit", "File", "Folder", "LikedByInformation", "ParentList", "Properties", "
"Unpivoted Other Columns" - Table.UnpivotOtherColumns("Columnas eliminadas", "Cliente", "Campus", "Programa", "DPE", "CLUSTER", "Atributo", "Valor")
En
"Unpivoted Other Columns"

Intenté cambiar #removed columnas a Source, recibí un error sobre el cliente no se estaba encontrando

@Lobs

Puedo comprobarlo si puede compartir un conjunto de datos de ejemplo.

________________________

Si mi respuesta fue útil, considere Aceptarla como la solución para ayudar a los otros miembros a encontrarla

Haga clic en el icono Thumbs-Up si le gusta esta respuesta 🙂

Youtube Linkedin

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Hola

En sus datos en el archivo de Excel, este código M funciona muy bien

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcgQCJR0lQyCGMl2L8jJTgbRTalEJkCKAYnWilZyAAGoGlEm6Gc5AADUDyiTdDBcggJoBZZJuhqurK5BpBNILZpHtCiNKXBEMBFAzoEzSzYBGpzElMQu13IQSd1DRDNMBNSMWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Client = _t, Campus = _t, Program = _t, DPE = _t, #"CLUSTER " = _t, #"NOV 1 6PM" = _t, #"NOV 1 8PM" = _t, #"NOV 1 10PM" = _t, #"NOV 1 11PM" = _t, #"NOV 2 1AM" = _t, #"NOV 2 3 AM" = _t, #"NOV 2 4AM" = _t, #"NOV 2 6AM" = _t, #"NOV 2 8AM" = _t, #"NOV 2 10AM" = _t, #"NOV 2 12PM" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Client", type text}, {"Campus", Int64.Type}, {"Program", type text}, {"DPE", type text}, {"CLUSTER ", type text}, {"NOV 1 6PM", type text}, {"NOV 1 8PM", type text}, {"NOV 1 10PM", type text}, {"NOV 1 11PM", type text}, {"NOV 2 1AM", type text}, {"NOV 2 3 AM", type text}, {"NOV 2 4AM", type text}, {"NOV 2 6AM", type text}, {"NOV 2 8AM", type text}, {"NOV 2 10AM", type text}, {"NOV 2 12PM", type text}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Client", "Campus", "Program", "DPE", "CLUSTER "}, "Attribute", "Value")
in
    #"Unpivoted Other Columns"

Espero que esto ayude.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Supongo que estás viendo en blanco porque no tienes datos

No estoy seguro de si desea espacios en blanco en la salida final, pero se puede tratar así

let
    Source = Excel.Workbook(File.Contents("C:\Users\...\Sample.xlsx"), null, true),
    Sheet2_Sheet = Source{[Item="Sheet2",Kind="Sheet"]}[Data],
    #"Promoted Headers" = Table.PromoteHeaders(Sheet2_Sheet, [PromoteAllScalars=true]),
    #"Replaced Value" = Table.ReplaceValue(#"Promoted Headers",null,"zzz",Replacer.ReplaceValue,{"NOV 1 6PM", "NOV 1 8PM", "NOV 1 10PM", "NOV 1 11PM", "NOV 2 1AM", "NOV 2 3 AM", "NOV 2 4AM", "NOV 2 6AM", "NOV 2 8AM", "NOV 2 10AM", "NOV 2 12PM"}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Replaced Value", {"Client", "Campus", "Program", "DPE", "CLUSTER "}, "Attribute", "Value"),
    #"Replaced Value1" = Table.ReplaceValue(#"Unpivoted Other Columns","zzz","",Replacer.ReplaceText,{"Value"})
in
    #"Replaced Value1"

usted ve la salida como

sevenhills_0-1604186686947.png

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.