Forum Discussion

MarcUrdang's avatar
MarcUrdang
Post Patron
6 years ago
Solved

date creation

Good afternoon

 

I have two tables. In the one I split a particular date into a DAY , MONTH and YEAR. I need to use the MONTH and YEAR from this table and the DAY from another table in this way:  

 
Payment Date = date('Payment Summary'[Payment Year],'Payment Summary'[Payment MONTH use],'Payment Summary'[Payment DAY related])
 
However as I add data into the Excel datasource I get this error (although it mostly happens .. it sometimes doesn't) and I have no idea why. The error is:  An argument of function 'DATE' has the wrong data type or the result is too large or too small
 
I have no idea how to resolve this. Is there a better way to join those columns into a DATE?
 
thanks
Marc
  • kentyler's avatar
    kentyler
    6 years ago

    I have issues with Teams. It doesn't work well with me.

    But send me your email and I'll send you a Zoom meeting invitation.

    Ken Tyler

5 Replies

  • kentyler's avatar
    kentyler
    Solution Sage

    VAR pay_year ='Payment Summary'[Payment Year]

    VAR pay_month = 'Payment Summary'[Payment MONTH use]

    VAR pay_day = 'Payment Summary'[Payment DAY related]

    VAR pay_year_OK = pay_year >0

    VAR pay_month_OK = pay_month > 0 && pay_month <=12

    VAR pay_day_OK = pay_day > 0 && pay_day <=31

    Result = IF(pay_year_OK && pay_month_OK && pay_day_OK,date(pay_year,pay_month,pay_day), "Error in year, month or day")

    RETURN Result

     

    You could put more complex logic on the limits for pay_day depending on the value of pay_month

     

    • MarcUrdang's avatar
      MarcUrdang
      Post Patron

      Hi .. thank you so much for your quick response .. I am a fairly new user adn although I'm sure what you sent is fairly easy I am not entirely sure how to do replicate in my model. Would you be able to spend a minute via Teams so I can share my screen and you can talk me through it?

       

      thanks

      Marc

      • kentyler's avatar
        kentyler
        Solution Sage

        I have issues with Teams. It doesn't work well with me.

        But send me your email and I'll send you a Zoom meeting invitation.

        Ken Tyler