Forum Discussion

Gutts_Zero's avatar
Gutts_Zero
Frequent Visitor
3 years ago
Solved

ipmt and ppmt calculation has wrong data type or the result is too large/small

Was following a youtube video on PPMT and IPMT functions but encountered this error and don't know how to fix it.

 

Link to file 

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi  Gutts_Zero ,

     

    According to your description, here are my steps you can follow as a solution.

    (1) We can create measures.

    Measure = var _a=CALCULATE(MAX('Fact'[Period]),FILTER(ALL('Fact'),'Fact'[Period]=MAX('Fact'[Period]))) return IF([Is within Period]=0,1,_a)
    ipmt = ipmt(0.06/12,[Measure],'Loan Period'[Loan Period Value]*12,200000,0,0)

    (2) Then the result is as follows.

     

     

    Best Regards,

    Neeko Tang

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

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Gutts_Zero ,

     

    I'm sorry I don't have access to your pbix file.

    Double-check the data types and values of the arguments to be passed to the function to ensure that they are correct and within acceptable limits.

    According to the documentation, the per argument must be between 1 and nper (inclusive). However, in your measure, you have max(fact[period]) as the per argument, which may be greater than loan period [loan period value]*12, which is the nper argument. This could cause the error that you see.

     

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. 

     

    Best Regards,

    Neeko Tang

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

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi  Gutts_Zero ,

       

      According to your description, here are my steps you can follow as a solution.

      (1) We can create measures.

      Measure = var _a=CALCULATE(MAX('Fact'[Period]),FILTER(ALL('Fact'),'Fact'[Period]=MAX('Fact'[Period]))) return IF([Is within Period]=0,1,_a)
      ipmt = ipmt(0.06/12,[Measure],'Loan Period'[Loan Period Value]*12,200000,0,0)

      (2) Then the result is as follows.

       

       

      Best Regards,

      Neeko Tang

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