Forum Discussion

matthewtjy's avatar
matthewtjy
Helper I
5 years ago
Solved

Array Formula IF Condition Match, Return Latest Date

Hi, I have 2 tables [SalesRecords] and [SalesPersonID].

 

[SalesRecords] has every sales transaction for every sales person;

[SalesPersonID] has the distinct record of every sales person ID.

 

How could I get the Latest Sales made by each sales person from the [SalesRecord] table as a created column in [SalesPersonID] table (expected result in red in [SalesPersonID] table below).

 

Normally I would use the array formula in Column D:2 in excel as such {=MAX(IF(C2=A:A,B:B))}

 

SalesRecords

 Column AColumn B
Row 1SalesPersonIDSalesDate
Row 2John1 Jan 2020
Row 3John5 Feb 2020
Row 4John3 Mar 2020
Row 5 Tom4 Feb 2020
Row 6Tom5 Feb 2020

Row 7

Harry

6 Jan 2020
Row 8Harry1 Mar 2020
Row 9Harry8 Mar 2020
Row 10Harry10 Mar 2020

 

SalesPersonID

 Column CColumn D
Row 1SalesPersonIDLatestSalesDate
Row 2John3 Mar 2020
Row 3Tom5 Feb 2020
Row 4Harry10 Mar 2020

 

Many thanks!!

  • matthewtjy 

    you can create a column

    Column = maxx(FILTER('SalesRecords','SalesRecords'[SalesPersonID]='SaelsPersonID'[SalesPersonID]),'SalesRecords'[SalesDate])

     

3 Replies

  • matthewtjy 

    you can create a column

    Column = maxx(FILTER('SalesRecords','SalesRecords'[SalesPersonID]='SaelsPersonID'[SalesPersonID]),'SalesRecords'[SalesDate])

     

  • Hi,

    Write this calculated column formula in the SalesPersonID table

    =calculate(max(slesrecords[alesdate]),filter(salespersonid,salespersonid[salesperonid]=earlier(salesrecords[salespersonid])))

    Hope this helps.