'Oldest Open Account in Power BI - DAX

I have a table that looks like this:

Customer ID AccountNumber OpenDate  CloseDate
125         0-00156       5/13/2016 null
125         0-00457       6/17/2018 null
125         0-00213       2/1/2010  6/7/2019

I would like to get the oldest open account for the customer using a calculated column



Solution 1:[1]

Try the measure below:

First, you need to find the oldest date in a dataset that contains only open accounts. Then just return the value for the row related to that date.

Customer oldest account num = 
VAR oldestAccDate = 
    CALCULATE(
        MIN( Customers[OpenDate] ),
        ALLEXCEPT( Customers, Customers[CustomerId] ),
        ISBLANK( Customers[CloseDate] )
    )
VAR result = 
    CALCULATE(
        MAX( Customers[AN] ),
        Customers[OpenDate] = oldestAccDate
    )
RETURN 
    result

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 intruderr