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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
zahidah_mabd
Helper I
Helper I

Check Title VS Gender

Hello, I would like to check for title x gender invalidation.

 

I have two columns which has the value as below

 

TitleGender
Mr.Male
EncikMale
Mrs.Female
MissFemale
Ms.Female
CikFemale
PuanFemale

 

I want to validate the values as follows.

Male =  Encik , Mr.
Female = Cik , Miss , Mrs. , Ms. , Puan

If not then it is invalid.

For example
[Title] = "Mr." and [Gender] = "Female" (Invalid)

Blank values are also invalid
These are some of the Invalid values

TitleGender
Mr.Female
 Male
Cik 
PuanMale


Can you help me?

1 ACCEPTED SOLUTION
Dhacd
Resolver III
Resolver III

Good day @zahidah_mabd,
This can be easily achieved using a switch,
Switch(true(),
      title in { "Encik", "Mr." } and Gender ="Male", "validmale,

      title in { "Cik" , "Miss" , "Mrs." , "Ms." , "Puan" } and Gender ="Female","validfemale",

       "invalid")

Proud to be a datanaut,

Marks as solution if this works for you.

Thanks and regards,

Atma.

View solution in original post

2 REPLIES 2
CNENFRNL
Community Champion
Community Champion

CNENFRNL_0-1654759393478.png

CNENFRNL_1-1654759994089.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Dhacd
Resolver III
Resolver III

Good day @zahidah_mabd,
This can be easily achieved using a switch,
Switch(true(),
      title in { "Encik", "Mr." } and Gender ="Male", "validmale,

      title in { "Cik" , "Miss" , "Mrs." , "Ms." , "Puan" } and Gender ="Female","validfemale",

       "invalid")

Proud to be a datanaut,

Marks as solution if this works for you.

Thanks and regards,

Atma.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.