Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Estoy perdido aquí. Estoy tratando de encontrar las conexiones para los pares de origen y destino. En este ejemplo DEN-ORD, me gustaría devolver DEN-ATL-ORD y así sucesivamente?
¿Es esto posible?
Gracias por la ayuda:)
O&D | Origen | Destino |
DEN-ATL | el | Atl |
DEN-DTW | el | Dtw |
LA PALABRA | el | Palabra |
DTW-DEN | Dtw | el |
DTW-ORD | Dtw | Palabra |
ATL-ORD | Atl | Palabra |
Solved! Go to Solution.
Hola @MrNoob ,
Prueba esto:
1. Cree dos tablas.
Origin = VALUES('Table'[Origin])
Destination = VALUES('Table'[Destination])
2. Cree segmentaciones de datos.
3. Cree una medida.
Measure =
VAR Origin_ =
SELECTEDVALUE ( Origin[Origin] )
VAR Destination_ =
SELECTEDVALUE ( Destination[Destination] )
VAR t1 =
SELECTCOLUMNS (
FILTER ( 'Table', 'Table'[Origin] = Origin_ ),
"Origin1", [Origin],
"Destination1", [Destination]
)
VAR t2 =
SELECTCOLUMNS (
FILTER ( 'Table', 'Table'[Destination] = Destination_ ),
"Origin2", [Origin],
"Destination2", [Destination]
)
VAR t3 =
FILTER (
CROSSJOIN ( t1, t2 ),
[Destination1] = [Origin2]
|| [Destination1] = Destination_
)
VAR t4 =
SUMMARIZE (
t3,
[Origin1],
[Destination1],
[Destination2],
"O&D_",
IF (
[Destination1] = Destination_,
[Origin1] & "-" & [Destination1],
[Origin1] & "-" & [Destination1] & "-" & [Destination2]
)
)
RETURN
CONCATENATEX ( t4, [O&D_], "," & UNICHAR ( 10 ) & " " )
BTW, archivo .pbix adjunto.
Saludos
Icey
Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
Hola, usé tu solución para mi informe. Funciona bien. Pero quiero calcular el tiempo total de vuelo.
Por ejemplo,
O&D | Origen | Destino | Hora de salida | Hora de llegada |
DEN-ATL | el | Atl | 12:00 | 15:00 |
DEN-DTW | el | Dtw | ||
LA PALABRA | el | Palabra | ||
DTW-DEN | Dtw | el | 08:00 | 10:00 |
DTW-ORD | Dtw | Palabra | ||
ATL-ORD | Atl | Palabra |
Quiero el tiempo total de vuelo DTW - DEN - ATL a las 7:00
¿Puede ser?
Gracias.
Hola @MrNoob ,
Prueba esto:
1. Cree dos tablas.
Origin = VALUES('Table'[Origin])
Destination = VALUES('Table'[Destination])
2. Cree segmentaciones de datos.
3. Cree una medida.
Measure =
VAR Origin_ =
SELECTEDVALUE ( Origin[Origin] )
VAR Destination_ =
SELECTEDVALUE ( Destination[Destination] )
VAR t1 =
SELECTCOLUMNS (
FILTER ( 'Table', 'Table'[Origin] = Origin_ ),
"Origin1", [Origin],
"Destination1", [Destination]
)
VAR t2 =
SELECTCOLUMNS (
FILTER ( 'Table', 'Table'[Destination] = Destination_ ),
"Origin2", [Origin],
"Destination2", [Destination]
)
VAR t3 =
FILTER (
CROSSJOIN ( t1, t2 ),
[Destination1] = [Origin2]
|| [Destination1] = Destination_
)
VAR t4 =
SUMMARIZE (
t3,
[Origin1],
[Destination1],
[Destination2],
"O&D_",
IF (
[Destination1] = Destination_,
[Origin1] & "-" & [Destination1],
[Origin1] & "-" & [Destination1] & "-" & [Destination2]
)
)
RETURN
CONCATENATEX ( t4, [O&D_], "," & UNICHAR ( 10 ) & " " )
BTW, archivo .pbix adjunto.
Saludos
Icey
Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
Hola, @MrNoob, es totalmente posible, pls probar el siguiente código,
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnH103UM8VHSAbGAJIgdqwMRdwkJh4uD2DBx/yAXuDiIDRYPCddFqITIwsSh6sHiMPVAe6DiENvB4rEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"O&D" = _t, Origin = _t, Destination = _t]),
OD = Source[#"O&D"],
#"Removed Columns" = Table.RemoveColumns(Source,{"O&D"}),
#"Merged Queries" = Table.NestedJoin(#"Removed Columns", {"Destination"}, #"Removed Columns", {"Origin"}, "Source", JoinKind.LeftOuter),
#"Renamed Columns" = Table.RenameColumns(#"Merged Queries",{{"Destination", "Exchange"}}),
#"Expanded Source" = Table.ExpandTableColumn(#"Renamed Columns", "Source", {"Destination"}, {"Destination"}),
#"Filtered Rows" = Table.SelectRows(#"Expanded Source", each ([Destination] <> null)),
#"Added Custom" = Table.AddColumn(#"Filtered Rows", "Custom", each if List.Contains(OD, [Origin] & "-" & [Destination]) then [Origin] & "-" & [Destination] else false),
#"Filtered Rows1" = Table.SelectRows(#"Added Custom", each ([Custom] <> false))
in
#"Filtered Rows1"
el resultado final
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |