Forum Discussion
Anonymous
6 years agoNot applicable
Customer classification logic
Hi all, I'm trying to create logic for a new column Customer Type: Customer Type classification -> Indoor, Outdoor, Both if all Actual instances of a customer are Indoor --> customer type is In...
- 6 years ago
Anonymous try something like this, add this as a column
Ask anything Power BI. Book appointment for a free consultancy at https://www.perytus.com
Customer Type = VAR __indoor = COUNTROWS( CALCULATETABLE( VALUES ( Customer[Product type] ), ALLEXCEPT ( Customer, Customer[Customer] ), Customer[Product type] = "Indoor" , CONTAINSSTRING( Customer[Status] , "Actual" ) ) ) VAR __outdoor =COUNTROWS( CALCULATETABLE( VALUES ( Customer[Product type] ), ALLEXCEPT ( Customer, Customer[Customer] ), Customer[Product type] = "Outdoor" , CONTAINSSTRING( Customer[Status] , "Actual" ) ) ) RETURN SWITCH ( TRUE(), __indoor = 1 && __outdoor = 1, "Both", __indoor = 1, "Indoor", __outdoor = 1, "Outdoor" )Would appreciate Kudos 🙂 if my solution helped.
parry2k
Super User
6 years agoAnonymous try something like this, add this as a column
Ask anything Power BI. Book appointment for a free consultancy at https://www.perytus.com
Customer Type =
VAR __indoor =
COUNTROWS(
CALCULATETABLE(
VALUES ( Customer[Product type] ),
ALLEXCEPT ( Customer, Customer[Customer] ),
Customer[Product type] = "Indoor" ,
CONTAINSSTRING( Customer[Status] , "Actual" )
)
)
VAR __outdoor =COUNTROWS(
CALCULATETABLE(
VALUES ( Customer[Product type] ),
ALLEXCEPT ( Customer, Customer[Customer] ),
Customer[Product type] = "Outdoor" ,
CONTAINSSTRING( Customer[Status] , "Actual" )
)
)
RETURN
SWITCH ( TRUE(),
__indoor = 1 && __outdoor = 1, "Both",
__indoor = 1, "Indoor",
__outdoor = 1, "Outdoor"
)
Would appreciate Kudos 🙂 if my solution helped.