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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.