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
Anonymous
Not applicable

Gender

Hello !

I need help categorizing different numbers that tell what gender it is.

Ex:
0, woman
1, man
2, woman
3, man

etc

Is there any good way to create a new variable for it?

 

2 ACCEPTED SOLUTIONS
DimaMD
Solution Sage
Solution Sage

Hi @Anonymous  try it

SWITCH(
    TRUE(),
    OR([#] = 0, [#] = 2), "woman",
    OR([#] = 1, [#] = 3), "man",
    "etc"
)   

Screenshot_11.jpg


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

View solution in original post

@Anonymous See also this file, I optimized the measure and gave 2 examples


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hello again!

I don't really know what I'm doing wrong, but it doesn't seem to work, I've tried several different options

Gender2 = SWITCH(TRUE(),
OR(Data_renter[Gender_number] = 0, Data_renter[Gender_number]=2), "Female",
OR(Data_renter[Gender_number] = 4, Data_renter[Gender_number]=6), "Female",
OR(Data_renter[Gender_number] = 8, Data_renter[Gender_number]=10), "Female",
OR(Data_renter[Gender_number] = 1, Data_renter[Gender_number]=3), "Male",
OR(Data_tenant[Gender_number] = 5, Data_tenant[Gender_number]=7), "Male",
OR(Data_renter[Gender_number] = 9, Data_renter[Gender_number]=11), "Male")

What am I doing wrong ?
 

@Anonymous See also this file, I optimized the measure and gave 2 examples


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

Hi @Anonymous What is the data type in the column? text or numeric?
Show the error you are getting, preferably with a screenshot
look at the attached file, maybe you will understand where you made a mistake


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com
DimaMD
Solution Sage
Solution Sage

Hi @Anonymous  try it

SWITCH(
    TRUE(),
    OR([#] = 0, [#] = 2), "woman",
    OR([#] = 1, [#] = 3), "man",
    "etc"
)   

Screenshot_11.jpg


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

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.