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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
qwertzuiop
Advocate III
Advocate III

Detect if a sending is early/late/same over n transports

Hello dear PowerBI-Community

 

Currently I am in great need of your support.

As shown below is a table showing the messages about a timechange in transports.

A transport always has a unique transportId.

 

I would like to be able to make a statement as to whether a transport is finally (last timeNew of the transport) earlier, later or at the same time as originally (first timeOld of the transport). These cases are highlighted in color.

 

The gray column is the actual solution I am looking for.

Any ideas?

 

transportIdcreatedtimeOldtimeNewEarlySameLate
8902019-09-28T19:00:112019-10-03T14:002019-10-01T14:00Same
8902019-09-30T07:00:122019-10-01T14:002019-10-02T14:00x
8902019-09-30T09:45:112019-10-02T14:002019-10-03T14:00x
3452019-10-01T05:30:282019-10-01T12:302019-10-03T12:30Late
3452019-10-01T15:30:162019-10-03T12:302019-10-02T12:30x
3452019-10-01T17:15:212019-10-02T12:302019-10-03T12:30x
3452019-10-01T17:30:212019-10-03T12:302019-10-02T12:30x
3452019-10-02T06:30:102019-10-02T12:302019-10-03T12:30x
3452019-10-02T08:15:192019-10-03T12:302019-10-03T08:25x
5672019-10-19T08:30:092019-10-22T12:302019-10-23T12:30Early
5672019-10-19T09:45:092019-10-23T12:302019-10-21T12:30x
1592019-10-23T04:15:202019-10-23T07:302019-10-23T15:30Late
1232019-10-29T11:45:122019-10-30T14:002019-11-04T11:30Late
1232019-10-29T19:45:152019-11-04T11:302019-10-31T14:00x
1232019-10-29T20:00:222019-10-31T14:002019-11-04T11:30x
1232019-10-30T07:00:152019-11-04T11:302019-10-31T14:00x
1232019-10-30T12:45:152019-10-31T14:002019-11-04T11:30x
1232019-10-31T06:30:102019-11-04T11:302019-10-31T14:00x
1232019-11-01T08:00:182019-10-31T14:002019-11-01T14:00x

 

Thank you so much for your support.

 

Cheers!

qwertzuiop

1 ACCEPTED SOLUTION
v-xuding-msft
Community Support
Community Support

Hi @qwertzuiop ,

I created a sample using calculated column. Please have a try. 

Column =
VAR min_date =
    CALCULATE (
        MIN ( 'Table'[created] ),
        ALLEXCEPT ( 'Table', 'Table'[transportId] )
    )
VAR max_date =
    CALCULATE (
        MAX ( 'Table'[created] ),
        ALLEXCEPT ( 'Table', 'Table'[transportId] )
    )
VAR a =
    CALCULATE (
        MAX ( 'Table'[timeOld] ),
        ALLEXCEPT ( 'Table', 'Table'[transportId] ),
        FILTER ( 'Table', 'Table'[created] = min_date )
    )
VAR b =
    CALCULATE (
        MAX ( 'Table'[timeNew] ),
        ALLEXCEPT ( 'Table', 'Table'[transportId] ),
        FILTER ( 'Table', 'Table'[created] = max_date )
    )
RETURN
    SWITCH ( TRUE (), a > b, "Early", a < b, "Late", a = b, "Same" )

3.PNG

Best Regards,

Xue Ding

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Kudos are nice too.

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-xuding-msft
Community Support
Community Support

Hi @qwertzuiop ,

I created a sample using calculated column. Please have a try. 

Column =
VAR min_date =
    CALCULATE (
        MIN ( 'Table'[created] ),
        ALLEXCEPT ( 'Table', 'Table'[transportId] )
    )
VAR max_date =
    CALCULATE (
        MAX ( 'Table'[created] ),
        ALLEXCEPT ( 'Table', 'Table'[transportId] )
    )
VAR a =
    CALCULATE (
        MAX ( 'Table'[timeOld] ),
        ALLEXCEPT ( 'Table', 'Table'[transportId] ),
        FILTER ( 'Table', 'Table'[created] = min_date )
    )
VAR b =
    CALCULATE (
        MAX ( 'Table'[timeNew] ),
        ALLEXCEPT ( 'Table', 'Table'[transportId] ),
        FILTER ( 'Table', 'Table'[created] = max_date )
    )
RETURN
    SWITCH ( TRUE (), a > b, "Early", a < b, "Late", a = b, "Same" )

3.PNG

Best Regards,

Xue Ding

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Kudos are nice too.

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.