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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
kfschaefer
Helper IV
Helper IV

Create new column concatenation of Month and Year

what is the correct syntax for creating a new column in existing query that has various fields.  I have two fields Month_Name and Year.  I want to create a new column that concetnates both columns togeth.  How do I modify the add column dax statement to include the concatenation?

 

Thanks,

Karen

 

= Table.AddColumn(#"Added Custom", "MMM_YYYY", each Text.From([Month_name]) & " " & Text.From([Year]))

1 ACCEPTED SOLUTION
edhans
Community Champion
Community Champion


@kfschaefer wrote:

what is the correct syntax for creating a new column in existing query that has various fields.  I have two fields Month_Name and Year.  I want to create a new column that concetnates both columns togeth.  How do I modify the add column dax statement to include the concatenation?

 

Thanks,

Karen

 

= Table.AddColumn(#"Added Custom", "MMM_YYYY", each Text.From([Month_name]) & " " & Text.From([Year]))


The above isn't DAX, that is M in Power query. You don't need Text.From() around Month_name as I assume that is text already. You do around [Year] assuming that is a 4 digit year. Your statement should be in your Dates table (or whatever table you have dates you want to convert, but you should do it in your Dates table anyway then join to the other table, but that is another post):

 

=Date.ToText([Date],"MMM" ) & "_" & Text.From(Date.Year([Date]))

That will use the date field to get the month and year, and put it in MMM_YYYY format as text.

 

If you want to do it in DAX by creating a custom column (which I do not recommend) you'd use this in your Dates table:

 

MMM_YYYY = FORMAT(Dates[Date],"MMM") & "_" & FORMAT(Dates[Date],"yyyy")


Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

 

LOL this what you guys have to do to get a Date/Month?!?! WOW i'm a Tableau Cert Professional. Started doing a part-time job using PowerBI. Yikes. I thought this was 'competition' to Tableau and holy hell it's not. DAX is downright pathetic. I am better off literally writing code in SQL. You can't even click and drag fields into the formula? The formula isn't seperate from visual? Can't interact with visual while formula still open in different window.

 

Seriously. Microsoft ALWAYS drops the ball, but this one is REALLY bad. If I was a developer I would be recommending any client away from this product. I mean imagine having to use 5 MS appilications/products to build a dashboard. Whew. Yeah I'll be writing all my code elsewhere. This is absolute garbage.

edhans
Community Champion
Community Champion

Hi @Anonymous - glad to have you here. 

This isn't DAX. It is the M code for the ETL component of Power BI. You know, the thing Tableau clients have to pay Alteryx licenses for.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
edhans
Community Champion
Community Champion


@kfschaefer wrote:

what is the correct syntax for creating a new column in existing query that has various fields.  I have two fields Month_Name and Year.  I want to create a new column that concetnates both columns togeth.  How do I modify the add column dax statement to include the concatenation?

 

Thanks,

Karen

 

= Table.AddColumn(#"Added Custom", "MMM_YYYY", each Text.From([Month_name]) & " " & Text.From([Year]))


The above isn't DAX, that is M in Power query. You don't need Text.From() around Month_name as I assume that is text already. You do around [Year] assuming that is a 4 digit year. Your statement should be in your Dates table (or whatever table you have dates you want to convert, but you should do it in your Dates table anyway then join to the other table, but that is another post):

 

=Date.ToText([Date],"MMM" ) & "_" & Text.From(Date.Year([Date]))

That will use the date field to get the month and year, and put it in MMM_YYYY format as text.

 

If you want to do it in DAX by creating a custom column (which I do not recommend) you'd use this in your Dates table:

 

MMM_YYYY = FORMAT(Dates[Date],"MMM") & "_" & FORMAT(Dates[Date],"yyyy")


Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.