This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreGet Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.
I need help identifying and categorizing customers in Power BI based on the selected date using the following conditions:
How can I achieve this using DAX or any other approach in Power BI? Any guidance or suggestions are appreciated.
Attached is the data sample Download Here
Hi,Rupak_bi and amustafa ,thanks for your concern about this issue.
Hello,@InsightSeeker .I am glad to help you.
Has your problem been solved?
If you have found suitable solutions, please share them as it will help more users with similar problems.
For example, relevant code or links to articles.
Or you can mark the valid suggestions provided by other users as solutions.
By the way, using ISINSCOPE() in the matrix allows you to determine the hierarchy in order to change the output in the MEASUREMENT (for the parent hierarchy you want to change the output)
ISINSCOPE function (DAX) - DAX | Microsoft Learn
Thank you very much for your understanding and support of Power BI.
I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian
Here is your solution in a matrix table. Ensure to break the date relationship between calender and data table.
Hi @Rupak_bi - I cannot break the date relationship between the calendar and data table, as my other tables rely on this relationship as well.
I created two DAX calculated columns in table 'data'...
FirstOrderDate =
CALCULATE(
MIN('data'[invoice_date]),
ALLEXCEPT('data', 'data'[customer_1])
)LastOrderDate =
CALCULATE(
MAX('data'[invoice_date]),
ALLEXCEPT('data', 'data'[customer_1])
)
Then a DAX measure as following...
CustomerCategory =
VAR SelectedDate = MAX('Calendar Ultimate'[Date])
VAR LastOrder = CALCULATE(MAX('data'[LastOrderDate]), ALLEXCEPT('data', 'data'[customer_1]))
VAR FirstOrder = CALCULATE(MIN('data'[FirstOrderDate]), ALLEXCEPT('data', 'data'[customer_1]))
VAR MonthsSinceLastOrder = DATEDIFF(LastOrder, SelectedDate, MONTH)
VAR MonthsSinceFirstOrder = DATEDIFF(FirstOrder, SelectedDate, MONTH)
RETURN
IF(
MonthsSinceLastOrder > 3,
"Lost Customer",
IF(
MonthsSinceFirstOrder > 12,
"Existing Customer",
"New Customer"
)
)
Results looks something like this...
Proud to be a Super User!
Hi @amustafa - The results at the group level are not displaying correctly in the table, whereas at the customer number (customer_1) level, the results are accurate. How can I ensure that the correct results are displayed at the group level as well?
Expected behavior:
How can I achieve this logic in my table?
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 25 | |
| 24 | |
| 22 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 43 | |
| 41 | |
| 41 | |
| 21 | |
| 21 |