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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

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

Anonymous
Not applicable

@Smauro

 

This looks like heavy lifting for a newbie.

 

Any other suggestions for a simple DAX statement?

@Anonymous, 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
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.