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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
flintstone
Helper II
Helper II

Determine Age, state and gender

I would like to get help to extract out details from an identity card eg 671109106173.

1) The last digit refers to gender. Odd refers to Male and Even refers to female. 

2) Age is 2020-1967 (first 2 digits)=53.

3) The 7 to 8 digit refers to the state of birth. So, 10 refers to Selangor

01Johor
02Kedah
03Kelantan
04Malacca
05Negeri Sembilan
06Pahang
07Penang
08Perak
09Perlis
10Selangor
11Terengganu
12Sabah
13Sarawak
14Federal Territory of Kuala Lumpur
15Federal Territory of Labuan
16Federal Territory of Putrajaya
17N/A
18N/A
19N/A
20N/A
21Johor
22Johor
23Johor
24Johor
25Kedah
26Kedah
27Kedah
28Kelantan
29Kelantan
30Malacca
31Negeri Sembilan
32Pahang
33Pahang
34Penang
35Penang
36Perak
37Perak
38Perak
39Perak
40Perlis
41Selangor
42Selangor
43Selangor
44Selangor
45Terengganu
46Terengganu
47Sabah
48Sabah
49Sabah
50Sarawak
51Sarawak
52Sarawak
53Sarawak
54Federal Territory of Kuala Lumpur
55Federal Territory of Kuala Lumpur
56Federal Territory of Kuala Lumpur
57Federal Territory of Kuala Lumpur
58Federal Territory of Labuan
59Negeri Sembilan

 

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@flintstone 

Gender = IF(ISODD(RIGHT([Column],1)*1),"Male","Female")

Age = 
  VAR __Year = LEFT([Column],2) * 1
RETURN
  IF __Year < 20, 2000+__Year,1900+__Year)

State = 
  VAR __Code = MID([Column],7,2)
RETURN
  MAXX(FILTER('States',[Code]=__Code),[State])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

@flintstone 

Gender = IF(ISODD(RIGHT([Column],1)*1),"Male","Female")

Age = 
  VAR __Year = LEFT([Column],2) * 1
RETURN
  IF __Year < 20, 2000+__Year,1900+__Year)

State = 
  VAR __Code = MID([Column],7,2)
RETURN
  MAXX(FILTER('States',[Code]=__Code),[State])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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