March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
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]))
Solved! Go to Solution.
@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")
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI Reporting
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.
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.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI Reporting
@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")
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingMarch 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
123 | |
86 | |
76 | |
57 | |
52 |
User | Count |
---|---|
201 | |
137 | |
108 | |
73 | |
68 |