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
Hola, soy nuevo en powerBI y estoy practicando con un panel personalizado, hasta ahora tan bueno, pero ahora estoy tratando de mostrar mis datos de una manera amigable y no puedo encontrar una manera.
Esto es lo que tengo:
Tabla de formación:
MatchID | Player_Name | Team_Initials |
1091 | Segundo DURANDAL | era |
1091 | René Fernández | era |
1091 | Ellos Luis | bien |
1091 | Velloso | bien |
Tabla WorldCupMatches (solo incluyo las columnas que siento que son relevantes):
MatchID | Home_Team_Initials | Away_Team_Initials |
1091 | bien | era |
Resultado previsto:
MatchID | Home_Team_Players | Home_Team_Initials | Away_Team_Initials | Away_Team_Players |
1091 | Ellos Luis | bien | era | Segundo DURANDAL |
1091 | Velloso | bien | era | René Fernández |
Ninguna de mis fórmulas DAX funcionó hasta ahora y estoy dudando de que si es posible, cualquier ayuda sería apreciada!
Solved! Go to Solution.
Hay @Radgost,
Puede probar esto en Power Query:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjSwNFTSUQpOTS/NS8lXcAkNcvRzcfQBCjn5+yjF6sBVBKXmpSq4pRblJealpFZhykelKviUZhaDJIIckSXCUnNy8ovzYRKxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [MatchID = _t, Player_Name = _t, Team_Initials = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"MatchID", Int64.Type}, {"Player_Name", type text}, {"Team_Initials", type text}}),
#"Merged Queries" = Table.NestedJoin(#"Changed Type", {"MatchID"}, #"WorldCupMatches Table", {"MatchID"}, "WorldCupMatches Table", JoinKind.LeftOuter),
#"Expanded WorldCupMatches Table" = Table.ExpandTableColumn(#"Merged Queries", "WorldCupMatches Table", {"MatchID", "Home_Team_Initials", "Away_Team_Initials"}, {"WorldCupMatches Table.MatchID", "WorldCupMatches Table.Home_Team_Initials", "WorldCupMatches Table.Away_Team_Initials"}),
#"Removed Columns" = Table.RemoveColumns(#"Expanded WorldCupMatches Table",{"WorldCupMatches Table.MatchID"}),
#"Added Custom" = Table.AddColumn(#"Removed Columns", "Custom", each if [Team_Initials]=[WorldCupMatches Table.Home_Team_Initials]
then 1
else 0),
#"Renamed Columns" = Table.RenameColumns(#"Added Custom",{{"WorldCupMatches Table.Home_Team_Initials", "Home_Team_Initials"}, {"WorldCupMatches Table.Away_Team_Initials", "Away_Team_Initials"}}),
#"Removed Columns1" = Table.RemoveColumns(#"Renamed Columns",{"Team_Initials"}),
#"Filtered Rows1" = Table.SelectRows(#"Removed Columns1", each ([Custom] = 0)),
#"Filtered Rows" = Table.SelectRows(#"Removed Columns1", each ([Custom] = 1)),
Custom1 = Table.AddColumn(#"Filtered Rows","tableA",each #"Filtered Rows1"[Player_Name]),
Custom2 = Table.AddColumn(#"Custom1","tableB",each if [Player_Name]=List.Min(#"Custom1"[Player_Name]) then List.Min([tableA]) else List.Max([tableA])),
#"Removed Columns2" = Table.RemoveColumns(Custom2,{"tableA", "Custom"}),
#"Renamed Columns1" = Table.RenameColumns(#"Removed Columns2",{{"Player_Name", "Home_Team_Players"}, {"tableB", "Away_Team_Players"}})
in
#"Renamed Columns1"
Aquí está la salida:
Por favor, pruebe el pbix adjunto.
Saludos
enlace
Si esta publicación ayuda, por favor considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
Hay @Radgost,
Puede probar esto en Power Query:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjSwNFTSUQpOTS/NS8lXcAkNcvRzcfQBCjn5+yjF6sBVBKXmpSq4pRblJealpFZhykelKviUZhaDJIIckSXCUnNy8ovzYRKxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [MatchID = _t, Player_Name = _t, Team_Initials = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"MatchID", Int64.Type}, {"Player_Name", type text}, {"Team_Initials", type text}}),
#"Merged Queries" = Table.NestedJoin(#"Changed Type", {"MatchID"}, #"WorldCupMatches Table", {"MatchID"}, "WorldCupMatches Table", JoinKind.LeftOuter),
#"Expanded WorldCupMatches Table" = Table.ExpandTableColumn(#"Merged Queries", "WorldCupMatches Table", {"MatchID", "Home_Team_Initials", "Away_Team_Initials"}, {"WorldCupMatches Table.MatchID", "WorldCupMatches Table.Home_Team_Initials", "WorldCupMatches Table.Away_Team_Initials"}),
#"Removed Columns" = Table.RemoveColumns(#"Expanded WorldCupMatches Table",{"WorldCupMatches Table.MatchID"}),
#"Added Custom" = Table.AddColumn(#"Removed Columns", "Custom", each if [Team_Initials]=[WorldCupMatches Table.Home_Team_Initials]
then 1
else 0),
#"Renamed Columns" = Table.RenameColumns(#"Added Custom",{{"WorldCupMatches Table.Home_Team_Initials", "Home_Team_Initials"}, {"WorldCupMatches Table.Away_Team_Initials", "Away_Team_Initials"}}),
#"Removed Columns1" = Table.RemoveColumns(#"Renamed Columns",{"Team_Initials"}),
#"Filtered Rows1" = Table.SelectRows(#"Removed Columns1", each ([Custom] = 0)),
#"Filtered Rows" = Table.SelectRows(#"Removed Columns1", each ([Custom] = 1)),
Custom1 = Table.AddColumn(#"Filtered Rows","tableA",each #"Filtered Rows1"[Player_Name]),
Custom2 = Table.AddColumn(#"Custom1","tableB",each if [Player_Name]=List.Min(#"Custom1"[Player_Name]) then List.Min([tableA]) else List.Max([tableA])),
#"Removed Columns2" = Table.RemoveColumns(Custom2,{"tableA", "Custom"}),
#"Renamed Columns1" = Table.RenameColumns(#"Removed Columns2",{{"Player_Name", "Home_Team_Players"}, {"tableB", "Away_Team_Players"}})
in
#"Renamed Columns1"
Aquí está la salida:
Por favor, pruebe el pbix adjunto.
Saludos
enlace
Si esta publicación ayuda, por favor considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
Hola Enlace! Gracias por esto! es exactamente lo que necesitaba. Aun así i'm actualmente enfrentando un asunto con esta línea y es debido a un error i hizo mientras escribí el correo. Los datos se dividen en dos archivos .csv, uno llamado "WorldCupMatches" y el otro llamado "WorldCupPlayers". Así que al llegar a este paso "= Table.TransformColumnTypes(Origen,{{"MatchID", Int64.Type}, {"Player_Name", escriba text}, {"Team_Initials", escriba text}})"
Se producirá un error en la consulta ya que la columna "Player_Name" está actualmente en un archivo diferente.
Voy a tratar de averiguarlo mientras tanto, pero cualquier puntero será apreciado.
Gracias de nuevo!
@Radgost , si la segunda tabla tiene un IDENTIFICADOR de coincidencia único, a continuación, simplemente unirse a los dos en match ID crear 1-M join(in data model) y usarlos en visual juntos
Si lo entendí correctamente, eso traerá los campos de una tabla a otra, pero no ayudará con la selección de campos creo, quise que la tabla final se mostrara al seleccionar un MatchID.
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.