cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
qwertzuiop Regular Visitor
Regular Visitor

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

Accepted Solutions
Highlighted
Community Support Team
Community Support Team

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

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.

View solution in original post

1 REPLY 1
Highlighted
Community Support Team
Community Support Team

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

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.

View solution in original post

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors (Last 30 Days)