Forum Discussion
sokatenaj
9 years agoAdvocate II
Need Help Creating a Calculated Column Based on Birth Year
Good afternoon, I am struggling here. I tried creating a conditional column or calculated column based on birth year but there is no "BETWEEN" function. I want to say, if Birth Year is between 19...
- Anonymous9 years ago
Generation = SWITCH( TRUE(), TableName[Birth Year] >= 1927 && TableName[Birth Year] <= 1945, "Mature/Silents", TableName[Birth Year] >= 1946 && TableName[Birth Year] <= 1964, "Baby Boomer", TableName[Birth Year] >= 1965 && TableName[Birth Year] <= 1980, "Gen X", TableName[Birth Year] >= 1981 && TableName[Birth Year] <= 1200, "Millenial", TableName[Birth Year] >= 2001, "Gen Z/Boomlet", BLANK() )Anything before 1927 will remain blank with this formula.
Edit: aww, Vvelarde beat me to it while I was testing something with the new table constructor.
Vvelarde
9 years agoCommunity Champion
Hi, Try with this DAX
Generation =
SWITCH (
TRUE (),
YEAR ( Table1[Birth Date] ) >= 1927
&& YEAR ( Table1[Birth Date] ) <= 1945, "Mature / Silents",
YEAR ( Table1[Birth Date] ) >= 1946
&& YEAR ( Table1[Birth Date] ) <= 1964, "Baby Boomer",
YEAR ( Table1[Birth Date] ) >= 1965
&& YEAR ( Table1[Birth Date] ) <= 1980, "Gen X",
YEAR ( Table1[Birth Date] ) >= 1981
&& YEAR ( Table1[Birth Date] ) <= 2000, "Millenials",
"Gen Z / Boomlet"
)Let me know if was helpful
Victor
Lima - Peru