+ Reply to Thread
Results 1 to 8 of 8

DAX formula for joining Year, Month and Day

  1. #1
    Registered User
    Join Date
    09-17-2015
    Location
    Israel
    MS-Off Ver
    Excel 2010
    Posts
    72

    DAX formula for joining Year, Month and Day

    Hi,

    I have a request to join three columns into one by showing a date in one column.

    See attached example. I need a DAX formula as a resolution.

    Please note that I have a row where the month and the date has no "0" before (e.g. Month = 6; Day = 3) where I would need to have at the expected date '06' for the Month and '03' for the Date.

    Thanks,
    Shai
    Attached Files Attached Files

  2. #2
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,279

    Re: DAX formula for joining Year, Month and Day

    Try in "D2"
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and copy paste down


    atul


    If my answer (or that of other members) has helped you, please say "Thanks" by clicking the Add Reputation button at the foot of one of their posts.

    Also: if your problem is solved, please take the time to mark your thread as SOLVED by going to the top of your first post, selecting "Thread Tools" and then "Mark thread as solved".

  3. #3
    Registered User
    Join Date
    09-17-2015
    Location
    Israel
    MS-Off Ver
    Excel 2010
    Posts
    72

    Re: DAX formula for joining Year, Month and Day

    I am getting the result as '42069' number which is not identified as a date, also when I am selecting a date format it stays as '42069' and not as a date.

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,652

    Re: DAX formula for joining Year, Month and Day

    Try:

    =TEXT(DATE(A2,B2,C2),"yyyymmdd")
    Quang PT

  5. #5
    Registered User
    Join Date
    09-17-2015
    Location
    Israel
    MS-Off Ver
    Excel 2010
    Posts
    72

    Re: DAX formula for joining Year, Month and Day

    I am getting an error as I cannot create the following syntax '=TEXT(DATE' together, any other ideas?

  6. #6
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: DAX formula for joining Year, Month and Day

    You said DAX so try: =[@[Year ]]&[@[Month ]]&[@Day] but table cannot be as range but as structured table.
    or =DATE([@[Year ]],[@[Month ]],[@Day])
    or =TEXT(DATE([@[Year ]],[@[Month ]],[@Day]),"yyyymmdd")

    btw. I don't understand why standard excel function DATE(year,month,day) is called DAX function
    Maybe Excel is Pocket Calculator now, who knows?
    Attached Files Attached Files
    Last edited by sandy666; 03-01-2017 at 06:11 AM.

  7. #7
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,279

    Re: DAX formula for joining Year, Month and Day

    Refer attach file. Formatting properly.
    Attached Files Attached Files

  8. #8
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: DAX formula for joining Year, Month and Day

    Hi,

    For a formatted string, the DAX might be
    =[Year]&FORMAT([Month],"00")&FORMAT([Day],"00")

    For an actual date you would, as previously suggested, use
    =DATE([Year],[Month],[Day])
    but there are no date formats built in to Power Pivot (I guess this is where you are using it) that are YYYYMMDD. If you require that format but stored as a number for some reason, you might use
    =[Year]*10000+[Month]*100+[Day]
    Don
    Please remember to mark your thread 'Solved' when appropriate.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Running Totals from 24 hours to month, month to year without year decreasing
    By Safetyintern in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-20-2015, 01:13 PM
  2. Graphing dates by month/year with 2 bars per month/year
    By Ellpoyohlokoh in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-22-2014, 05:25 AM
  3. Replies: 3
    Last Post: 09-04-2013, 10:49 AM
  4. If Column A Month and Year = ColumnB Todays Month and Year then send email
    By HACCStaff in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-15-2013, 12:47 AM
  5. Replies: 4
    Last Post: 02-14-2010, 05:21 AM
  6. formula for prior month & year of a month end date.
    By mikeburg in forum Excel General
    Replies: 2
    Last Post: 09-25-2007, 04:01 PM
  7. Formula to return last day of month for each month in year?
    By StargateFan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-03-2006, 12:10 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1