Forum Discussion
Anonymous
7 years agoNot applicable
Splitting Counties and States and State Code Conversion
I have a column called State/Country and it contains either a country name (e.g. Korea) or a state code (e.g. CA)
What I need to do is to separate those into 2 columns:
Var = State/Country
If length(Var) > 2 then CountryColumn = Var, StateColumn = “ “
Else CountryColumn=USA, StateColumn = decodeStateAbbr (??)
My questions: how can I write this in DAX and how can I decode state abbriviation?
Anonymous not sure wht you mean by decode state abbreviation. here is calculated columns looks like
Country = IF( LEN(Table[Country/State]) > 2, Table[Country/State], "USA" ) State = IF( LEN(Table[Country/State]) > 2, "", Table[Country/State])
6 Replies
- parry2kSuper User
Anonymous not sure wht you mean by decode state abbreviation. here is calculated columns looks like
Country = IF( LEN(Table[Country/State]) > 2, Table[Country/State], "USA" ) State = IF( LEN(Table[Country/State]) > 2, "", Table[Country/State])