Forum Discussion
Anonymous
1 year agoNot applicable
Creating category column for customer
Hi all, Due to my beginner knowledge of DAX, I would like to ask for help with creating Category collumn for customers in PBI table view. I have tried AI, but after hours of trying, ending up st...
- 1 year ago
Hi Anonymous please try this calculated column
Customer Category =VAR Has_Oct_Dec =CALCULATE(SUM(Sheet6[Volume]),ALLEXCEPT(Sheet6, Sheet6[Customer ID], Sheet6[Location Code]),Sheet6[year month] IN {"2024-10", "2024-11", "2024-12"}) > 0VAR Has_Only_Zero_Jan_Feb =CALCULATE(SUM(Sheet6[Volume]),ALLEXCEPT(Sheet6, Sheet6[Customer ID], Sheet6[Location Code]),Sheet6[year month] IN {"2025-01", "2025-02"}) = 0VAR Has_Mar =CALCULATE(SUM(Sheet6[Volume]),ALLEXCEPT(Sheet6, Sheet6[Customer ID], Sheet6[Location Code]),Sheet6[year month] = "2025-03") > 0VAR Has_All_Months =CALCULATE(COUNTROWS(FILTER(Sheet6, Sheet6[Volume] > 0)),ALLEXCEPT(Sheet6, Sheet6[Customer ID], Sheet6[Location Code])) = DISTINCTCOUNT(Sheet6[year month])RETURNSWITCH(TRUE(),Has_All_Months, "Constant",Has_Mar && NOT Has_Oct_Dec && Has_Only_Zero_Jan_Feb, "New",Has_Oct_Dec && Has_Only_Zero_Jan_Feb && Has_Mar, "Renewed","Other")
techies
Super User
1 year agoHi Anonymous please try this calculated column
Customer Category =
VAR Has_Oct_Dec =
CALCULATE(
SUM(Sheet6[Volume]),
ALLEXCEPT(Sheet6, Sheet6[Customer ID], Sheet6[Location Code]),
Sheet6[year month] IN {"2024-10", "2024-11", "2024-12"}
) > 0
VAR Has_Only_Zero_Jan_Feb =
CALCULATE(
SUM(Sheet6[Volume]),
ALLEXCEPT(Sheet6, Sheet6[Customer ID], Sheet6[Location Code]),
Sheet6[year month] IN {"2025-01", "2025-02"}
) = 0
VAR Has_Mar =
CALCULATE(
SUM(Sheet6[Volume]),
ALLEXCEPT(Sheet6, Sheet6[Customer ID], Sheet6[Location Code]),
Sheet6[year month] = "2025-03"
) > 0
VAR Has_All_Months =
CALCULATE(
COUNTROWS(FILTER(Sheet6, Sheet6[Volume] > 0)),
ALLEXCEPT(Sheet6, Sheet6[Customer ID], Sheet6[Location Code])
) = DISTINCTCOUNT(Sheet6[year month])
RETURN
SWITCH(
TRUE(),
Has_All_Months, "Constant",
Has_Mar && NOT Has_Oct_Dec && Has_Only_Zero_Jan_Feb, "New",
Has_Oct_Dec && Has_Only_Zero_Jan_Feb && Has_Mar, "Renewed",
"Other"
)
Anonymous
1 year agoNot applicable
Hello Techies,
Thank you very much, this one is working:)
BR,
Dominik