Forum Discussion

CCConsulting's avatar
CCConsulting
Regular Visitor
1 year ago
Solved

Add column in (one) table with max value from another table (many)

Would greatly appreicate help with this. I want to add a column to Table 1 that inserts the maximum value of "Invoice #" from that Account/Customer's multipe rows in Table 2.  Next I want to populate...
  • mdaatifraza5556's avatar
    1 year ago

    Hi CCConsulting 

    Can you please follow the below steps and use the dax to get your requirement ?

     

    Since Invoice #  is in text format, I am assuming the values are sequential alphabetically.

    1. Create a calculated column on table1.

    Most Recent Invoice # =
    CALCULATE(
        MAX('Table2'[Invoice #]),
        FILTER(
            'Table2',
            'Table2'[Customer Number] = 'Table1'[Account Number]
        )
    )

     



    2. Create final calculated column in table1.

    New Charges from Most Recent Invoice =
    LOOKUPVALUE(
        'Table2'[New Charges],
        'Table2'[Customer Number], 'Table1'[Account Number],
        'Table2'[Invoice #], 'Table1'[Most Recent Invoice #]
    )

     

     

    If this answers your questions, kindly accept it as a solution and give kudos.