cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Greg5
Frequent Visitor

Approval Date less than the Order Date (two Tables)

Hello,

I'm creating an SLA indicator for this, I need to do this formula below.

I have two tables, one containing the order number, order creation date and request number that originated the order, the other has the approval date of the requests that some have a re-approval date after the creation date of the request.

I need to bring to the order table, the approval date that is the last approval date before the order creation date.

RC - APPROVAL DATE
1 10/12/2022
2 10/07/2022

RC - APPROVAL DATE
1 10/08/2022
1 10/14/2022
2 10/05/2022
2 10/06/2022
2 10/10/2022

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

Hi @Greg5 ,

According to your description, seems you messed up the data. I create a sample.

Order table:

vkalyjmsft_0-1667383439111.png

Approval table:

vkalyjmsft_1-1667383450321.png

Here's my solution. Create a calculated column in Order table:

Column =
MAXX (
    FILTER (
        'Approval',
        'Approval'[Request num] = EARLIER ( 'Order'[request number] )
            && 'Approval'[APPROVAL DATE] <= EARLIER ( 'Order'[order creation date] )
    ),
    'Approval'[APPROVAL DATE]
)

Get the correct result:

vkalyjmsft_2-1667383527013.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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-yanjiang-msft
Community Support
Community Support

Hi @Greg5 ,

According to your description, seems you messed up the data. I create a sample.

Order table:

vkalyjmsft_0-1667383439111.png

Approval table:

vkalyjmsft_1-1667383450321.png

Here's my solution. Create a calculated column in Order table:

Column =
MAXX (
    FILTER (
        'Approval',
        'Approval'[Request num] = EARLIER ( 'Order'[request number] )
            && 'Approval'[APPROVAL DATE] <= EARLIER ( 'Order'[order creation date] )
    ),
    'Approval'[APPROVAL DATE]
)

Get the correct result:

vkalyjmsft_2-1667383527013.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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

ryan_mayu
Super User
Super User

you provided two sample data of approval table. What's the sample data in another table?

What's the expected output?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Submit your Data Story

Data Stories Gallery

Share your Data Story with the Community in the Data Stories Gallery.

Top Solution Authors