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

yearmonth as whole number

hi,

if i have a date column & i wish to create another column that contains a converted value for yearmonthday as a whole number, kindly advise on how to do so. 

 

for example, a date '12/08/2020' (i.e. 12th August, 2020) to be converted as 20200812 (yearmonthday) as a whole number type/format.

 

tks, -nik

3 ACCEPTED SOLUTIONS
pranit828
Community Champion
Community Champion

Hi @Anonymous 

 

YYYYMMDD_format = FORMAT('Table'[date],"YYYYMMDD")

Thank you @Greg_Deckler        And then right click the column and change it to a Whole number.





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

View solution in original post

@Anonymous - Just to add to @pranit828 you could then right-click the column and change it to a Whole number. FORMAT retuns a Text value.


@ 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

amitchandak
Super User
Super User

@Anonymous ,

Try like

Whole Date = year([Date])*10000 + month([Date])*100 + Day([Date])

or

Whole Date = format([Date],"YYYYMMDD") // This will be the text you need to change data type to whole number

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous ,

Try like

Whole Date = year([Date])*10000 + month([Date])*100 + Day([Date])

or

Whole Date = format([Date],"YYYYMMDD") // This will be the text you need to change data type to whole number

pranit828
Community Champion
Community Champion

Hi @Anonymous 

 

YYYYMMDD_format = FORMAT('Table'[date],"YYYYMMDD")

Thank you @Greg_Deckler        And then right click the column and change it to a Whole number.





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile
Anonymous
Not applicable

many2 tks, @pranit828 , @amitchandak & @Greg_Deckler .

 

@Anonymous - Just to add to @pranit828 you could then right-click the column and change it to a Whole number. FORMAT retuns a Text value.


@ 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...

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.