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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
maurcoll
Helper III
Helper III

First/earliest Date

Hi 
i am trying to work out which is the earliest/First order date per customer as per the below. I have been trying to use the earlier function where the customer number = earlier customer number and order date = min order date but it doesn't seem to be working, i just get blanks.  I am trying to create it as a calculated column

var earliestdate = CALCULATE(MIN('customer'[Order Date]),
                        FILTER('customer', 'customer' [Customer Number] = EARLIER( 'customer' [Customer Number])))


RETURN
IF(Order Date = earliestdate , "First", BLANK())

Customer NumberOrder NumberOrder DateProduct NumberOrdered
1117/01/202512First
1117/01/202513First
1117/01/202514First
1220/01/202512 
1220/01/202515 
1220/01/202516 
2318/01/202521First
2318/01/202525First
2431/01/202526 
2425/01/202521 
2425/01/202525 
3518/01/202521First
3619/01/202523 
1 ACCEPTED SOLUTION
pankajnamekar25
Super User
Super User

Hello @maurcoll 

 

Us this DAX to create calculated column

Ordered =

VAR EarliestDate =

    CALCULATE(

        MIN('customer'[Order Date]),

        ALLEXCEPT('customer', 'customer'[Customer Number])

    )

RETURN

    IF('customer'[Order Date] = EarliestDate, "First", BLANK())

 

Thanks,
 Pankaj Namekar | LinkedIn

If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.

View solution in original post

2 REPLIES 2
Sasidhar1
Regular Visitor

Hi @maurcoll , 

Hope you are doing well.

I can see there is no issue with  the dax what you have written and the output is also expected as we are having different dates for a customer number that was mapped to blank and for customer for min order date is mapped to First.

 

Let us know what is the output you are expecting.

 

Thanks

pankajnamekar25
Super User
Super User

Hello @maurcoll 

 

Us this DAX to create calculated column

Ordered =

VAR EarliestDate =

    CALCULATE(

        MIN('customer'[Order Date]),

        ALLEXCEPT('customer', 'customer'[Customer Number])

    )

RETURN

    IF('customer'[Order Date] = EarliestDate, "First", BLANK())

 

Thanks,
 Pankaj Namekar | LinkedIn

If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.