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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

First sales date of a customer

Hi All, 

 

I need the first salesdate of every customer in my data.

This first sales must contain the category code "beachflags" and have at least an amount (salesamount) of 750. 

 

How can i make this in DAX with the variables 

custnr

catogrycode

salesamount 

salesdate

 

I hope someone have a solution

1 ACCEPTED SOLUTION

@Anonymous 

 

Assuming you are trying to create a custom column and not a measure, this probably should work. 

 

First Sales Date =
// Return true if it is a first order
Sales[salesdate] = 
CALCULATE (
    MIN ( Sales[salesdate] ),
    ALL ( Sales),
    Sales[custnr]  = Earlier(Sales[custnr] ),
    Sales[catogrycode] = "beachflags",
    Sales[salesamount] >= 750
)

View solution in original post

7 REPLIES 7
OwenAuger
Super User
Super User

@Anonymous 

You can create a calculated column like this (adjust column names as required):

First Sales Date =
CALCULATE (
    MIN ( Sales[salesdate] ),
    ALLEXCEPT ( Sales, Sales[custnr] ),
    Sales[catogrycode] = "beachflags",
    Sales[salesamount] >= 750
)

This formula retains just the customer filter from the current row, then also applies the category and amount filters.

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn
Anonymous
Not applicable

@OwenAuger 

ok thanks! 

 

Do you also have a solution for the following: 

all the customers where the very first salesorder contains beachflags and an amount > 750

hi, @Anonymous 

Use ALL instead of ALLEXCEPT

Spoiler
Measure =
CALCULATE (
    MIN ( Sales[salesdate] ),
    ALL ( Sales ),
    Sales[catogrycode] = "beachflags",
    Sales[salesamount] >= 750
)

 If not your case, please share your sample data and expected output.

 

Best Regards,
Lin

 

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hello @v-lili6-msft 

I only need the customers where the first order ever of this customer, contains beachflags and an amount above 750.

 

image.png

@Anonymous  - I see there have been a few posts on this.

Just clarifying the requirements.

Do you want to identify all customers whose first ever order was "beachflags" and >=750, and then include all rows relating to those customers? 

For example, in the table you posted, you want to include all rows for Custno=4 since that customer meets the condition?

 

Also, do you want to create a calculated column flagging the relevant rows, or create a filter on the fly to use within a measure?


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn
Anonymous
Not applicable

Whose first beachflags order was >= 750. 

And i want those customers in a matrix, doesn't matter if it works with a measure or calculated column

@Anonymous 

 

Assuming you are trying to create a custom column and not a measure, this probably should work. 

 

First Sales Date =
// Return true if it is a first order
Sales[salesdate] = 
CALCULATE (
    MIN ( Sales[salesdate] ),
    ALL ( Sales),
    Sales[custnr]  = Earlier(Sales[custnr] ),
    Sales[catogrycode] = "beachflags",
    Sales[salesamount] >= 750
)

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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