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
bvdm1980
Helper I
Helper I

add custom column with year and month concentenated

Hi, i was going through "design a data model in BI" training course, and came at the part where you can add a custom column by adding an applied step, and use dax in custom column to create the MonthYear column

I have my standard calender table created with 5 columns (date/year/month/week of year/day), and added a new step in my applied step, copied the dax code (i typed it as well but just to be sure i copied, so i can't make typo). BUt i cant get it working :

Column = Table.AddColumn(#"Renamed Columns", "Custom", each [Year] & "-" &[Month])

 

My last 2 applied steps are :

bvdm1980_0-1652793841441.png

 

So i click "custom colum" to insert new column, and i see this

bvdm1980_1-1652794250827.png

then i use the formula:

bvdm1980_4-1652794585042.png

 

but then my column shows value "table" in every cell and i can't change the formate of this new column to "date" type...what am i missing in my steps? Tried several times but it just won't work. 

 

 

3 REPLIES 3
bvdm1980
Helper I
Helper I

thanks both! i'm gonna try that today, and will let you know if it works

v-jayw-msft
Community Support
Community Support

Hi @bvdm1980 ,

 

Try to add a custom column use below formula.

https://docs.microsoft.com/en-us/powerquery-m/date-totext 

Date.ToText([date],[Format="yyyy-MM"])

vjaywmsft_0-1653032065583.png

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
johnt75
Super User
Super User

You could try wrapping both the [Year] and [Month] columns in Text.From()

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.

Top Solution Authors