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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
labuser1235
Helper IV
Helper IV

Time taken to reach expected results

Hi All,

 

I have been trying to understand the time required to reach the target. 
When my expected orders till date is the current todays date.

 

Can someone please help me how should I calculate the time required to reach the target.

 

TableA    
Company IDCompany NameTotal Order Received Till dateExpected orders till dateOver or under orders received till date
100Company ABC1020-10
101Company DEF20155
102Company GHI1520-5

 

 

TableB   
CompanyIDCompany NameDateOders Received
100Company ABCMonday, January 3, 20221
101Company DEFWednesday, January 5, 20222
100Company ABCWednesday, January 5, 20222
102Company GHIFriday, January 7, 20222
100Company ABCMonday, April 4, 20227
101Company DEFTuesday, April 12, 202218
102Company GHIMonday, April 18, 202213

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @labuser1235,

You can try to use the following calculated column formula to lookup the table 2 records to get the first date that reaches or exceed the required amount.

Expected Date =
VAR summary =
    SUMMARIZE (
        FILTER ( Table2, [Company ID] = EARLIER ( 'Table'[Company ID] ) ),
        [CompanyID],
        [Date],
        "rolling",
            CALCULATE (
                SUM ( Table2[Oders Received] ),
                FILTER (
                    Table2,
                    [CompanyID] = EARLIER ( Table2[CompanyID] )
                        && [Date] <= EARLIER ( Table2[Date] )
                )
            )
    )
RETURN
    IF (
        [Over or under orders received till date] < 0,
        MINX (
            FILTER (
                summary,
                [rolling]
                    >= (
                        EARLIER ( 'Table'[Expected orders till date] )
                            - EARLIER ( 'Table'[Total Order Received Till date] )
                    )
            ),
            [Date]
        )
    )

1.png

Regards,

Xiaoxin Sheng

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

HI @labuser1235,

You can try to use the following calculated column formula to lookup the table 2 records to get the first date that reaches or exceed the required amount.

Expected Date =
VAR summary =
    SUMMARIZE (
        FILTER ( Table2, [Company ID] = EARLIER ( 'Table'[Company ID] ) ),
        [CompanyID],
        [Date],
        "rolling",
            CALCULATE (
                SUM ( Table2[Oders Received] ),
                FILTER (
                    Table2,
                    [CompanyID] = EARLIER ( Table2[CompanyID] )
                        && [Date] <= EARLIER ( Table2[Date] )
                )
            )
    )
RETURN
    IF (
        [Over or under orders received till date] < 0,
        MINX (
            FILTER (
                summary,
                [rolling]
                    >= (
                        EARLIER ( 'Table'[Expected orders till date] )
                            - EARLIER ( 'Table'[Total Order Received Till date] )
                    )
            ),
            [Date]
        )
    )

1.png

Regards,

Xiaoxin Sheng

amitchandak
Super User
Super User

@labuser1235 The information you have provided is not making the problem clear to me. Can you please explain with an example.

Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi Amit Thanks for your response.
In the above table, For Example..
I expected to receive 20 orders by 18th April, for a company ABC. However, I have received only 10 orders until 18th April. I am still under 10 (20 expected - 10 Total orders received) orders from expected. 
I would like to know based on the dates I have received the orders howmany long days it might take to receive all the expected orders from that company.

I hope I was able to explain it in good terms. Thanks in advance.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.