cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper I
Helper I

Combinando 2 mesas en una

Hola

Necesito su apoyo para el siguiente tema:

Tengo 2 tablas iniciales:

Pestaña 1: "Lista de proveedores"

Pestaña 2: "Lista de auditoría realizada" - Nota: no todos los proveedores de la pestaña 1 se incluyen en la pestaña 2 - depende de si la auditoría "Tipo X" se realizó o no.

Quiero encontrar la mejor manera de generar una tercera tabla basada en la 2 anterior, que representará, para cada tipo de "Auditoría", la auditoría "Estado" para cada proveedor "Nombre" en la pestaña 1. Si no se encuentra "Estado" en la pestaña 2, escriba "No hecho".

Aquí hay una representación simplificada:

PBi.JPG

Gracias y saludos.

1 ACCEPTED SOLUTION
Super User IV
Super User IV

@MarwenA , Crear una nueva tabla

NewTable : crossjoin(suppliers, Distinct(Audit[Audit type]))

y añadir esta nueva columna
new column á coalesce(maxx(filter(Audit, Audit[suppliers] ?NewTable[suppliers] && Audit[Audit type] ?NewTable[Audit type]),[Audit Type]),"Not Done")

También puede combinar la consulta de potenciahttps://radacad.com/append-vs-merge-in-power-bi-and-power-query



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

5 REPLIES 5
Super User IV
Super User IV

@MarwenA

Duplicar la tabla de proveedores y realizar la transformación:

Puede descargar el archivo:HERE

Fowmy_1-1600178909277.png

________________________

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!

Proud to be a Super User!




Super User II
Super User II

Hola @MarwenA

puede hacerlo en Power Query de la siguiente manera:

15-09-_2020_15-42-40.png

// Audit list
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUQqpLEhVMAQy/AtS85RidaKVnJBFnXPyi1NTwOLOWFXDzTDCaoYRDjNQVLvARI2xiprARWMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, Audit = _t, Status = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Audit", type text}, {"Status", type text}}),
    #"Removed Other Columns" = Table.SelectColumns(#"Changed Type",{"Audit"}),
    #"Removed Duplicates" = Table.Distinct(#"Removed Other Columns"),
    #"Added Custom" = Table.AddColumn(#"Removed Duplicates", "Custom", each #"Name list"),
    #"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"Name"}, {"Name"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Expanded Custom",{"Name", "Audit"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Reordered Columns",{{"Name", type text}}),
    #"Merged Queries" = Table.NestedJoin(#"Changed Type1", {"Name", "Audit"}, #"List of audit performed", {"Name", "Audit"}, "List of audit performed", JoinKind.LeftOuter),
    #"Expanded List of audit performed" = Table.ExpandTableColumn(#"Merged Queries", "List of audit performed", {"Status"}, {"Status"}),
    #"Replaced Value" = Table.ReplaceValue(#"Expanded List of audit performed",null,"Not done",Replacer.ReplaceValue,{"Status"})
in
    #"Replaced Value"

// Name list
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUVKK1YlWcoIxnGEMFxjDFcZwAzNiAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, Region = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Region", type text}}),
    #"Removed Other Columns" = Table.SelectColumns(#"Changed Type",{"Name"}),
    #"Removed Duplicates" = Table.Distinct(#"Removed Other Columns")
in
    #"Removed Duplicates"

// List of audit performed
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUQqpLEhVMAQy/AtS85RidaKVnJBFnXPyi1NTwOLOWFXDzTDCaoYRDjNQVLvARI2xiprARWMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, Audit = _t, Status = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Audit", type text}, {"Status", type text}})
in
    #"Changed Type"

// List of suppliers
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUVKK1YlWcoIxnGEMFxjDFcZwAzNiAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, Region = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Region", type text}})
in
    #"Changed Type"

Con saludos amables desde la ciudad donde la leyenda del 'Pied Piper de Hamelin' está en casa
FrankAT (Orgulloso de ser un Datanaut)

Super User IV
Super User IV

@MarwenA , Crear una nueva tabla

NewTable : crossjoin(suppliers, Distinct(Audit[Audit type]))

y añadir esta nueva columna
new column á coalesce(maxx(filter(Audit, Audit[suppliers] ?NewTable[suppliers] && Audit[Audit type] ?NewTable[Audit type]),[Audit Type]),"Not Done")

También puede combinar la consulta de potenciahttps://radacad.com/append-vs-merge-in-power-bi-and-power-query



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

Super User IV
Super User IV

@MarwenA Parece que debería usar una consulta Merge en Power Query Editor


---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hola Greg,

No estoy seguro de saber cómo hacerlo.. ¿Puede ayudar con los detalles por favor ?

Gracias.

Helpful resources

Announcements
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors