Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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
| Customer Number | Order Number | Order Date | Product Number | Ordered |
| 1 | 1 | 17/01/2025 | 12 | First |
| 1 | 1 | 17/01/2025 | 13 | First |
| 1 | 1 | 17/01/2025 | 14 | First |
| 1 | 2 | 20/01/2025 | 12 | |
| 1 | 2 | 20/01/2025 | 15 | |
| 1 | 2 | 20/01/2025 | 16 | |
| 2 | 3 | 18/01/2025 | 21 | First |
| 2 | 3 | 18/01/2025 | 25 | First |
| 2 | 4 | 31/01/2025 | 26 | |
| 2 | 4 | 25/01/2025 | 21 | |
| 2 | 4 | 25/01/2025 | 25 | |
| 3 | 5 | 18/01/2025 | 21 | First |
| 3 | 6 | 19/01/2025 | 23 |
Solved! Go to Solution.
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.
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
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.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 37 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 133 | |
| 88 | |
| 85 | |
| 68 | |
| 64 |