Forum Discussion

Steven_Wu's avatar
Steven_Wu
Frequent Visitor
3 years ago
Solved

How to convert the integer into date for calculation?

Hi, All,

I got a table as follow:

DateYear PeriodResult
2011-9-652016-9-6
2012-6-342016-6-3
2003-4-552008-4-5

 

Is there any way to add the Year Period(Integer) to the date for getting the Result column?

Because the table is generated in DAX, so I cannot use the Power Query for date calculation.

Hope to deal with this case with DAX.

Thank you~

  • Hello,

    You can do it this way:

    Result = DATE(YEAR('Table'[Date])+'Table'[Year Period], MONTH('Table'[Date]), DAY('Table'[Date]))

     

    If this post helps, then please consider accepting it as the solution to help other members find it more quickly. Thank You!!

     

2 Replies

  • JoBI's avatar
    JoBI
    Resolver II

    Hello,

    You can do it this way:

    Result = DATE(YEAR('Table'[Date])+'Table'[Year Period], MONTH('Table'[Date]), DAY('Table'[Date]))

     

    If this post helps, then please consider accepting it as the solution to help other members find it more quickly. Thank You!!

     

    • Steven_Wu's avatar
      Steven_Wu
      Frequent Visitor

      Thank you, JoBI~
      It works~ Thank you so much~ ğŸ˜€