Forum Discussion
Date format
- Anonymous6 years ago
Hi can you try these steps? It does seem to work for me:
1) in Power BI click on Edit Queries in the Home Tab
2) Look for the birthdate column, click on it
3) Go to the Transform tab and click on Split Column
4) Choose "By delimiter" and select "Custom" in the dropdown menu that pops up
5) In the textfield below the dropdown, type in "GMT"
6) Pick "left-most delimiter"
7) Press OK
8.) Power BI will split your data in two different columns named Birthdate.1 and Birthdate.2
Birthdate.1 will be transform to a Date/Time type.
9) Don't forget to go to the home tab and press Close&Apply
These steps will result in the following DateTime column
Let me know if this works for you.
Birthdate.1
31-12-1989 15:00:00 31-12-1989 15:00:00 31-12-1949 15:00:00 31-12-1989 15:00:00 31-12-1989 15:00:00 31-12-1989 15:00:00 31-12-1969 15:00:00 31-12-1959 15:00:00 31-12-1969 15:00:00 31-12-1989 15:00:00 31-12-1974 15:00:00 31-12-1988 15:00:00 31-12-1969 15:00:00 31-12-1993 15:00:00 31-12-1959 15:00:00 31-12-1979 15:00:00 31-12-1988 15:00:00 31-12-1998 15:00:00 31-12-1992 15:00:00 31-12-1949 15:00:00 31-12-1969 15:00:00 31-12-1959 15:00:00 31-12-1989 15:00:00 31-12-1987 15:00:00 31-12-1969 15:00:00 31-12-1964 15:00:00 31-12-1969 16:00:00 22-5-2001 17:00:00 31-12-1979 16:00:00 31-12-1994 16:00:00 31-12-2018 16:00:00 31-12-1989 16:00:00 10-7-1979 17:00:00 17-8-1971 17:00:00 31-12-2018 16:00:00 19-8-1979 17:00:00 31-12-1989 16:00:00 31-12-1938 16:00:00 31-12-2018 16:00:00 16-12-2019 16:00:00 16-12-2019 16:00:00 16-12-2019 16:00:00 19-12-2019 16:00:00 31-12-2018 16:00:00 25-12-2019 16:00:00 - 6 years ago
Hi Anonymous ,
Try the following DAX, I think region is the problem.
Column = var a =SEARCH(" ",'Table'[birthDate],1)+1 var b = SEARCH(" ",'Table'[birthDate],5)+1 var c = SEARCH(" ",'Table'[birthDate],9)+1 var d = MID('Table'[birthDate],a,3) var e = SWITCH( TRUE(), d="Dec",12, d="Nov",11, d="Oct",10, d="Sep",9, d="Aug",8, d="Jul",7, d="Jun",6, d="May",5, d="Apr",4, d="Mar",3, d="Feb",2, d="Jan",1 ) return IF(c=12, MID('Table'[birthDate],b,2), 0&MID('Table'[birthDate],b,1) ) &"-"&e&"-"&MID('Table'[birthDate],c,4)Here is the test file for your reference.
New format = format(date,"DD/MM/YYYY")
For age take date diff. Prefer orginal column in date format
Age = datediff(date,today(),YEAR)
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners/ba-p/890814
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p/881739
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601
HI amitchandak,
Before to calculate the age how can I transfer this type :
"Thu Dec 31 1964 15:00:00 GMT-0800 (Pacific Standard Time)" to 31/12/1964 ?
Thank you.
- Anonymous6 years agoNot applicable
Hi,
Can you try going to the column where you store the birtdate, then select it.
Go to the modeling tab and select Format in the Formatting Area.
There you should be able to pick the formatting you want.
- Anonymous6 years agoNot applicable
Yes, I did this, but it not work.
The software can not read this type of format "Thu Dec 31 1964 15:00:00 GMT-0800 (Pacific Standard Time)", and even if I choose format date in the modeling, i have a error.
- amitchandak6 years agoSuper User
Try create a new field and check if taken as date , force date data type
New date = mid(datenow,9,2) & "-" & mid(datenow,4,3) & "-" & mid(datenow,11,4)