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
Bbrown44
Advocate II
Advocate II

convert numeric value to year (DATE field)

I am trying to use one of the custom visuals from the Power BI Market place called 3AG Systems - Column Chart with Variance

 

It requires that the your category field be a date variable.  I have a date variable that Power BI only view as a numeric value.  I assume that is because is only the year (i.e., 2018).  How do I covert this numberic value to a date value.  The edit query field conversion does not change the value.  See example below:

 

Beforenumeric to year format.JPG

 

 

Afterafter.JPG

 

 

As you can see the date move to 1905. Please advise.

2 ACCEPTED SOLUTIONS
jthomson
Solution Sage
Solution Sage

Well that's what 2016 as a numeric date value ought to convert to... assuming it doesn't really matter what date in a given year you need it to be, make a custom column saying "01/01/" and then merge that with your year column. It should then give you a format that you can convert to date type.

View solution in original post

v-lili6-msft
Community Support
Community Support

HI, @Bbrown44

After my test, the category field doesn't need a date variable.

for example:

11.JPG

I have three type of category: text, number, date

then I separate drag them into the category field of bar chart with variance.

They work well

12.JPG

 

Also If you want to convert numeric value to date.

you do it like this:

change the column type into Text first.

for example

13.JPG

then convert to date

14.JPG

Note:

When converting text to date and this window appears

Click Add new step

15.JPG

Otherwise it will not success.

 

 

Best Regards,
Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Saiful20000
New Member

Add number of days from 1900 to 2000

JulianaMacedo
Helper I
Helper I

Hi I'm facing a similar problem but couldn't find my solution with the suggested steps, I tried it but did not work.

 

I mean, it would be easier to add 2000+ to all numbers if I new all of them are from the year 2000 and ahead... but if I have any year bellow that then this does not work.

 

Is there a smart way to do this?

 

I have a column with 2-digit numbers that I need to transform into a new columsn with 4 digitis as the Year.

Column 1Desired result
202020
212021
202020
192019
212021
192019
v-lili6-msft
Community Support
Community Support

HI, @Bbrown44

After my test, the category field doesn't need a date variable.

for example:

11.JPG

I have three type of category: text, number, date

then I separate drag them into the category field of bar chart with variance.

They work well

12.JPG

 

Also If you want to convert numeric value to date.

you do it like this:

change the column type into Text first.

for example

13.JPG

then convert to date

14.JPG

Note:

When converting text to date and this window appears

Click Add new step

15.JPG

Otherwise it will not success.

 

 

Best Regards,
Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
jthomson
Solution Sage
Solution Sage

Well that's what 2016 as a numeric date value ought to convert to... assuming it doesn't really matter what date in a given year you need it to be, make a custom column saying "01/01/" and then merge that with your year column. It should then give you a format that you can convert to date type.

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.