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

Búsqueda de conexiones aéreas

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&DOrigenDestino
DEN-ATLelAtl
DEN-DTWelDtw
LA PALABRAelPalabra
DTW-DENDtwel
DTW-ORDDtwPalabra
ATL-ORDAtlPalabra
1 ACCEPTED SOLUTION
Community Support
Community Support

Hola @MrNoob ,

Prueba esto:

1. Cree dos tablas.

Origin = VALUES('Table'[Origin])
Destination = VALUES('Table'[Destination])

re.JPG

2. Cree segmentaciones de datos.

slicer.gif

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 ) & " " )

od.gif

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.

View solution in original post

3 REPLIES 3
Frequent Visitor

Hola, usé tu solución para mi informe. Funciona bien. Pero quiero calcular el tiempo total de vuelo.
Por ejemplo,

O&DOrigenDestinoHora de salidaHora de llegada
DEN-ATLelAtl12:0015:00
DEN-DTWelDtw
LA PALABRAelPalabra
DTW-DENDtwel08:0010:00
DTW-ORDDtwPalabra
ATL-ORDAtlPalabra

Quiero el tiempo total de vuelo DTW - DEN - ATL a las 7:00

¿Puede ser?

Gracias.

Community Support
Community Support

Hola @MrNoob ,

Prueba esto:

1. Cree dos tablas.

Origin = VALUES('Table'[Origin])
Destination = VALUES('Table'[Destination])

re.JPG

2. Cree segmentaciones de datos.

slicer.gif

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 ) & " " )

od.gif

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.

View solution in original post

Super User III
Super User III

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

Screenshot 2020-10-01 021418.png

Helpful resources

Announcements
secondImage

Congratulations!

We are excited to announce the Power BI Super Users!

Wave Release 2

Check out the updates in Power BI.

Overview of Power BI 2020 release wave 2!

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.