Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
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
Solved! Go to 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 )
@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
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
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
Hello @v-lili6-msft
I only need the customers where the first order ever of this customer, contains beachflags and an amount above 750.
@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?
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 )
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
78 | |
76 | |
53 | |
37 | |
31 |
User | Count |
---|---|
101 | |
56 | |
51 | |
45 | |
40 |