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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
MaxItaly
Helper III
Helper III

Calculated Column: Extract max date of related entries

Hello everyone,

I am trying to achieve something that shouldn't be really hard, but I'm not quite capable with LOOKUPVALUE.

I have three tables:

OrderTable, where I have ShippingDate of several articles.

ContractRows, where I have the amount of article that need to be sold.

ContractHeader, where I have information about the contract.

The tables are linked together this way:

[OrderTable]1 - *[ContractRows]1 - *[ContractHeader]

 

So, for every Order in ContractHeader I have information about what and how much must be sold in ContractRows, and in OrderTables I have information about what has been shipped.

What I'd like to have is a calculated column in ContractHeader, where I have a flag if there has been atleast an order in the past six months.

I guess I should look for the dates in OrderTables linked to the same contract number, extract the max one related to the same contract and check if the date is in the last six months.

 

My biggest problem is how to extract the maximum order date related to the same contract (if there is one), I should be able to perform the rest.

Maybe I don't even have to use LOOKUPVALUE, but I'm not sure.

May give me a hint?
Many thanks!

1 ACCEPTED SOLUTION

Hi MaxItaly,

 

Create a calculate column and try this pattern:

Flag =
IF (
    COUNTROWS (
        FILTER (
            RELATEDTABLE ( OrderTable ),
            OrderTable[date] >= EDATE ( TODAY (), -6 )
                && OrderTable[date] <= TODAY ()
        )
    ) >= 1,
    "flag",
    BLANK ()
)

Regards,

Jimmy Tao

View solution in original post

3 REPLIES 3
MaxItaly
Helper III
Helper III

Nevermind, I guess it was easier than I thought:

may be

CALCULATE(MAX(ShipDate); RELATEDTABLE(OrderTable)) correct?

Hi MaxItaly,

 

Create a calculate column and try this pattern:

Flag =
IF (
    COUNTROWS (
        FILTER (
            RELATEDTABLE ( OrderTable ),
            OrderTable[date] >= EDATE ( TODAY (), -6 )
                && OrderTable[date] <= TODAY ()
        )
    ) >= 1,
    "flag",
    BLANK ()
)

Regards,

Jimmy Tao

Thanks, this is good as well, and it includes the second part of my request.

Thanks!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors