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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
maurcoll
Helper IV
Helper IV

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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.