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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Daniel_B
Helper II
Helper II

New Column with values based on integer in original column

Hi All


I've found roundabout versions of this which I've tried but they don't seem to yield the results I need and I think it's (again) because of my lack of knowledge of when to use which functions

 

What I'm trying to do is - If column A contains 1 or 2 THEN "Unhappy", ELSE IF column A contains 3 THEN "Neither Happy nor Unhappy" ELSE "Happy"... 4 & 5 would be happy but I assumed that once all other criterion had been met the final else would fill in the remaining values

 

Thanks for any help

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @Daniel_B 

try SWITCH statement like

= SWITCH(TRUE(),
[Column A] = 1 || [Column A] = 2, "Unhappy",
[Column A] = 3, "Neither Happy nor Unhappy",
[Column A] = 4 || [Column A] = 5, "would be happy",
"Happy"
)

and you can scale it as you wish

 

do not hesitate to give a kudo to useful posts and mark solutions as solution

LinkedIn


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

1 REPLY 1
az38
Community Champion
Community Champion

Hi @Daniel_B 

try SWITCH statement like

= SWITCH(TRUE(),
[Column A] = 1 || [Column A] = 2, "Unhappy",
[Column A] = 3, "Neither Happy nor Unhappy",
[Column A] = 4 || [Column A] = 5, "would be happy",
"Happy"
)

and you can scale it as you wish

 

do not hesitate to give a kudo to useful posts and mark solutions as solution

LinkedIn


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.