Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Calculating Remaining Day

I have a expire date column so I wan't to calculate remaining years,months,days left based on current date.

I'm getting only days when I used DATEDIFF function. 

But I wan't to show year,month,day also in same column

How to achive this

 

 

 

  • Hello Anonymous ,

     

    Not sure what you are doing wrong.

    I hope you have already created Calculated column as you mentioned above as-

     

    Remaning Days = Datediff(Today(),'sheet1'[warranty expires],DAY)

     

    Please try creating below one more calculated column-

    Converted = QUOTIENT('Sheet1'[Remaining Days], 365) & " years " &  QUOTIENT(MOD('Sheet1'[Remaining Days],365),30) & " months " & MOD(MOD('Sheet1'[Remaining Days],365),30) & " days"

     

    Please mark it as answer if it resolves your issue. Kudos are also appreciated.

     

3 Replies

  • Hello Anonymous ,

     

    Please use below DAX on top of your calculation for Remaining Days-

     

    Converted = QUOTIENT('Table'[Remaining Days], 365) & " years " &  QUOTIENT(MOD('Table'[Remaining Days],365),30) & " months " & MOD(MOD('Table'[Remaining Days],365),30) & " days"

     

    Please mark it as answer if it solves your issue. Kudos are also appreciated.

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    I'm getting results like this.

    I wan't to show remaining days left based on todays date.

    • Shishir22's avatar
      Shishir22
      Icon for Solution Sage rankSolution Sage

      Hello Anonymous ,

       

      Not sure what you are doing wrong.

      I hope you have already created Calculated column as you mentioned above as-

       

      Remaning Days = Datediff(Today(),'sheet1'[warranty expires],DAY)

       

      Please try creating below one more calculated column-

      Converted = QUOTIENT('Sheet1'[Remaining Days], 365) & " years " &  QUOTIENT(MOD('Sheet1'[Remaining Days],365),30) & " months " & MOD(MOD('Sheet1'[Remaining Days],365),30) & " days"

       

      Please mark it as answer if it resolves your issue. Kudos are also appreciated.