cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ChristianDGreat
Resolver I
Resolver I

Filter all the lines that based on status

Hello everyone.

 

I got stucked on this and need a bit of assistance.

 

So I have this table, and its connected using the OrderLine#

 

Order NumberOrderLine#Sales
AORDER1A1000
AORDER2B1000
AORDER1C1000
BORDER1CC2000

 

OrderLine#StatusTimestamp
1AInquiry11/5/22 6:00 AM
1ABooked11/6/22 6:00 AM
1AShipped11/7/22 6:00 AM
1AClosed11/8/22 6:00 AM
2BInquiry11/9/22 6:00 AM
2BBooked11/10/22 6:00 AM
2BCancelled11/12/22 6:00 AM
1CInquiry11/13/22 6:00 AM
1CBooked11/14/22 6:00 AM
1CShipped11/15/22 6:00 AM

 

The goal here is to only show the result of a status = closed

in this case

 

If I filter the Order Number = AORDER

It will only show this,

 

OrderLine#DateDiff
1A3

 

*Date Diff is the date difference between - 11/5/22 and 11/8/22 (from Inquiry to closed)

 

Again the goal is to show only the orderline# that is closed but need to consider all the historical of it.

 

1A - in our example this show because it has a closed status 

2B - this didnt show because it doesnt have a closed status

1C -  this didnt show because it doesnt have a closed status

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

Hi @ChristianDGreat ,

 

According to your description, here is my solution. Please follow these steps.

Create a calculated column.

datediff =
VAR _Closed =
    MAXX (
        FILTER (
            'Table (2)',
            [OrderLine#] = EARLIER ( [OrderLine#] )
                && [Status] = "Closed"
        ),
        [Timestamp]
    )
VAR _Inquiry =
    MAXX (
        FILTER (
            'Table (2)',
            [OrderLine#] = EARLIER ( [OrderLine#] )
                && [Status] = "Inquiry"
        ),
        [Timestamp]
    )
RETURN
    IF (
        _Closed <> BLANK ()
            && _Inquiry <> BLANK (),
        DATEDIFF ( _Inquiry, _Closed, DAY )
    )

Put it to the filter, and select "is not blank", then you will get the final output.

vxiaosunmsft_0-1667895066352.png

 

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ xiaosun

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

2 REPLIES 2
v-xiaosun-msft
Community Support
Community Support

Hi @ChristianDGreat ,

 

According to your description, here is my solution. Please follow these steps.

Create a calculated column.

datediff =
VAR _Closed =
    MAXX (
        FILTER (
            'Table (2)',
            [OrderLine#] = EARLIER ( [OrderLine#] )
                && [Status] = "Closed"
        ),
        [Timestamp]
    )
VAR _Inquiry =
    MAXX (
        FILTER (
            'Table (2)',
            [OrderLine#] = EARLIER ( [OrderLine#] )
                && [Status] = "Inquiry"
        ),
        [Timestamp]
    )
RETURN
    IF (
        _Closed <> BLANK ()
            && _Inquiry <> BLANK (),
        DATEDIFF ( _Inquiry, _Closed, DAY )
    )

Put it to the filter, and select "is not blank", then you will get the final output.

vxiaosunmsft_0-1667895066352.png

 

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ xiaosun

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

 

Thanks, it's working!

The EARLIER is what I'm missing 😯.

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors