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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It 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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Fabric Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.