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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Related table last occurance

I am fairly new to power bi, but experienced in MSAccess vba. This project has been a bit of a challenge for me.

 

I have 2 tables, Contracts & Tickets. I am trying to find the contract number with a start date that was just prior to the ticket opened date.

 

 

Contracts:

Itm

Contract

StartDt

EndDt

Aaa

123

12/1/18

12/3/18

BBB

124

12/1/18

12/4/18

BBB

126

12/5/18

12/12/18

Aaa

128

12/6/18

12/10/18

 

Ticket:

TickNbr

Itm

Opened

5678

Aaa

12/4/18

5679

Aaa

12/7/18

5680

BBB

11/30/18

 

Results:

TickNbr

Itm

Contract

5678

Aaa

123

5679

Aaa

128

5680

BBB

Null

 

Any help would be appreciated!

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous

 

Try this as a calculated column in Ticket Table

 

Calc Column in Ticket Table =
MINX (
    TOPN (
        1,
        FILTER (
            Contracts,
            Contracts[Itm] = Ticket[Itm]
                && Contracts[StartDt] < Ticket[Opened]
        ),
        Contracts[StartDt], DESC
    ),
    [Contract]
)

Regards
Zubair

Please try my custom visuals

View solution in original post

2 REPLIES 2
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous

 

Try this as a calculated column in Ticket Table

 

Calc Column in Ticket Table =
MINX (
    TOPN (
        1,
        FILTER (
            Contracts,
            Contracts[Itm] = Ticket[Itm]
                && Contracts[StartDt] < Ticket[Opened]
        ),
        Contracts[StartDt], DESC
    ),
    [Contract]
)

Regards
Zubair

Please try my custom visuals
Anonymous
Not applicable

Thank you! Worked perfect!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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