Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
sokatenaj
Advocate II
Advocate 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 1927 to 1945 then Mature/Silents ELSE IF Birth Year is between 1946-1964 then Baby Boomer ELSE IF birth year is between..etc You get the picture.

 

 I want it all in 1 column because I have birth year as a column in my table but want to create a new column using that logic above and eventually use it as a slicer. I am stuck! Any help would be appreciated. Please and thank you!

 

  • Mature/Silents.- Born 1927 to 1945
  • Baby Boomer – 1946 to 1964
  • Gen X – 1965 to 1980
  • Millennials – 1981 to 2000 Milennial
  • Gen Z/Boomlet – 2001 forward
1 ACCEPTED SOLUTION
KHorseman
Community Champion
Community Champion

 

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.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
KHorseman
Community Champion
Community Champion

 

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.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thank you both!!! I can't believe it was that simple!!! Jeez. I'll keep this one in my back pocket! 

Vvelarde
Community Champion
Community Champion

@sokatenaj

 

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




Lima - Peru

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.