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
irnm8dn
Post Prodigy
Post Prodigy

Month Day Year Separate Columns - Concatenate to Complete Date - HELP! - DAX?

My data source is creating three separate columns, for Year, Month, Day, each recognized as a whole number.

 

I am looking for a simple statement that allows me to concatenate these elements and format as a date.

 

Appreciate all of the help from the PBI community.

 

Thanks!

1 ACCEPTED SOLUTION

the simple statement could be DATE function:

 

date.JPG

 

 

View solution in original post

7 REPLIES 7
Smauro
Solution Sage
Solution Sage

One solution could be combining them together in Power Query and then transforming the column to type date.

If you go to advanced editor in query editor and add these lines:

    CombinedYMD = Table.CombineColumns(Table.TransformColumnTypes(#"Previous Step", {{"month", type text}, {"day", type text}, {"year", type text}}, "en-US"),{"month", "day", "year"},Combiner.CombineTextByDelimiter("/", QuoteStyle.None),"Date"),
    CombinedYMDtoDate = Table.TransformColumnTypes(CombinedYMD, {{"Date", type date}})
in
    CombinedYMDtoDate

Replacing "#"Previous Step"" with the previous step's name in your query and month/day/year by your column names, it should work.




Feel free to connect with me:
LinkedIn

@Smauro

 

This looks like heavy lifting for a newbie.

 

Any other suggestions for a simple DAX statement?

@irnm8dn, see @pawel1's solution. It's a lot easier and better than mine. Kudos to him. 🙂




Feel free to connect with me:
LinkedIn

the simple statement could be DATE function:

 

date.JPG

 

 

What if the month columns are month names, not number?? (January, February, March...)

I cannot get it to recognize DateFormat.  Any suggestions?

Hi,

 

Share some data and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.