Forum Discussion
Rolling XIRR per project
Dear All,
I'm trying to calculate the rolling IRR per project but I can't find a suitable query. I want an IRR that develops over time so I can see when the IRR goes from negative to positive.
Query I used for the calculation for all projects (data I used is shown below the query):
Data:
| Current Face/Funded Amount | Transaction Type | Transaction Date | Security/Facility HID | Cash flow | Cash flow amount | Index | Gross IRR |
| € 1.000.000 | Facility - Purchase | 1-7-2014 | 24639 | Cash flow - out | 1.000.000 -€ | 9 | |
| € 1.000.000 | Loan - Interest Payment | 31-7-2014 | 24639 | Cash flow - in | € 194,44 | 11 | 6,02% |
| € 1.000.000 | Loan - Interest Payment | 31-8-2014 | 24639 | Cash flow - in | € 5.833,33 | 18 | 6,02% |
| € 1.000.000 | Loan - Interest Payment | 30-9-2014 | 24639 | Cash flow - in | € 5.833,33 | 21 | 6,02% |
| € 1.000.000 | Loan - Interest Payment | 31-10-2014 | 24639 | Cash flow - in | € 5.833,33 | 29 | 6,02% |
| € 1.000.000 | Loan - Interest Payment | 30-11-2014 | 24639 | Cash flow - in | € 5.833,33 | 33 | 6,02% |
| € 1.000.000 | Loan - Interest Payment | 31-12-2014 | 24639 | Cash flow - in | € 5.833,33 | 37 | 6,02% |
| € 1.000.000 | Loan - Interest Payment | 31-1-2015 | 24639 | Cash flow - in | € 5.833,33 | 43 | 6,02% |
| € 1.000.000 | Loan - Interest Payment | 28-2-2015 | 24639 | Cash flow - in | € 4.414,38 | 54 | 6,02% |
| € 1.000.000 | Loan - Interest Payment | 31-3-2015 | 24639 | Cash flow - in | € 4.414,38 | 65 | 6,02% |
| € 1.009.000 | Loan - Interest Payment | 30-4-2015 | 24639 | Cash flow - in | € 4.414,38 | 71 | 6,02% |
| € 1.009.000 | Facility - Commitment Increase | 30-4-2015 | 24639 | Cash flow - out | 9.000 -€ | 72 | 6,02% |
| € 1.009.000 | Loan - Interest Payment | 31-5-2015 | 24639 | Cash flow - in | € 4.414,37 | 80 | 6,02% |
| € 1.009.000 | Loan - Interest Payment | 30-6-2015 | 24639 | Cash flow - in | € 4.414,38 | 88 | 6,02% |
| € 1.009.000 | Loan - Interest Payment | 31-7-2015 | 24639 | Cash flow - in | € 4.414,38 | 92 | 6,02% |
| € 1.009.000 | Loan - Interest Payment | 31-8-2015 | 24639 | Cash flow - in | € 4.414,38 | 103 | 6,02% |
| € 1.009.000 | Loan - Interest Payment | 30-9-2015 | 24639 | Cash flow - in | € 4.414,38 | 120 | 6,02% |
| € 1.000.000 | Facility - Purchase | 1-10-2015 | 23922 | Cash flow - out | 1.000.000 -€ | 128 | 6,02% |
| € 1.009.000 | Loan - Interest Payment | 31-10-2015 | 24639 | Cash flow - in | € 4.414,38 | 129 | 6,02% |
| € 1.000.000 | Loan - Interest Payment | 31-10-2015 | 23922 | Cash flow - in | € 5.416,67 | 136 | 6,02% |
| € 1.000.000 | Loan - Interest Payment | 30-11-2015 | 23922 | Cash flow - in | € 5.416,67 | 145 | 6,02% |
| € 1.009.000 | Loan - Interest Payment | 30-11-2015 | 24639 | Cash flow - in | € 4.414,38 | 146 | 6,02% |
| € 1.009.000 | Loan - Interest Payment | 31-12-2015 | 24639 | Cash flow - in | € 4.414,38 | 167 | 6,02% |
| € 1.006.000 | Loan - Interest Payment | 31-12-2015 | 23922 | Cash flow - in | € 5.416,67 | 168 | 6,02% |
| € 1.006.000 | Facility - Commitment Increase | 31-12-2015 | 23922 | Cash flow - out | 6.000 -€ | 170 | 6,02% |
| € 1.006.000 | Loan - Interest Payment | 31-1-2016 | 23922 | Cash flow - in | € 5.449,17 | 190 | 6,02% |
| € 1.015.054 | Loan - Interest Payment | 31-1-2016 | 24639 | Cash flow - in | € 4.440,86 | 191 | 6,02% |
| € 1.015.054 | Facility - Commitment Increase | 31-1-2016 | 24639 | Cash flow - out | 6.054 -€ | 199 | 6,02% |
| € 1.006.000 | Loan - Interest Payment | 29-2-2016 | 23922 | Cash flow - in | € 5.449,17 | 207 | 6,02% |
| € 1.015.054 | Loan - Interest Payment | 29-2-2016 | 24639 | Cash flow - in | € 4.440,86 | 225 | 6,02% |
| € 1.006.000 | Loan - Interest Payment | 31-3-2016 | 23922 | Cash flow - in | € 5.449,17 | 228 | 6,02% |
| € 1.015.054 | Loan - Interest Payment | 31-3-2016 | 24639 | Cash flow - in | € 4.440,86 | 236 | 6,02% |
| € 1.015.054 | Loan - Interest Payment | 30-4-2016 | 24639 | Cash flow - in | € 4.440,86 | 249 | 6,02% |
| € 1.006.000 | Loan - Interest Payment | 30-4-2016 | 23922 | Cash flow - in | € 5.449,17 | 258 | 6,02% |
| € 1.006.000 | Loan - Interest Payment | 31-5-2016 | 23922 | Cash flow - in | € 5.449,17 | 274 | 6,02% |
| € 1.015.054 | Loan - Interest Payment | 31-5-2016 | 24639 | Cash flow - in | € 4.440,86 | 278 | 6,02% |
| € 1.015.054 | Loan - Interest Payment | 30-6-2016 | 24639 | Cash flow - in | € 4.440,86 | 293 | 6,02% |
| € 1.006.000 | Loan - Interest Payment | 30-6-2016 | 23922 | Cash flow - in | € 5.449,17 | 303 | 6,02% |
| € 1.015.054 | Loan - Interest Payment | 31-7-2016 | 24639 | Cash flow - in | € 4.440,86 | 316 | 6,02% |
| € 1.006.000 | Loan - Interest Payment | 31-7-2016 | 23922 | Cash flow - in | € 5.449,17 | 326 | 6,02% |
| € 1.006.000 | Loan - Interest Payment | 31-8-2016 | 23922 | Cash flow - in | € 5.449,17 | 340 | 6,02% |
| € 0 | Facility - Paydown | 31-8-2016 | 24639 | Cash flow - in | € 1.015.054 | 343 | 6,02% |
| € 0 | Loan - Interest Payment | 31-8-2016 | 24639 | Cash flow - in | € 3.256,63 | 350 | 6,02% |
| € 1.006.000 | Loan - Interest Payment | 30-9-2016 | 23922 | Cash flow - in | € 5.449,17 | 373 | 6,02% |
| € 1.006.000 | Loan - Interest Payment | 31-10-2016 | 23922 | Cash flow - in | € 5.449,17 | 402 | 6,02% |
| € 1.006.000 | Loan - Interest Payment | 30-11-2016 | 23922 | Cash flow - in | € 5.449,17 | 428 | 6,02% |
| € 1.007.006 | Loan - Interest Payment | 31-12-2016 | 23922 | Cash flow - in | € 5.449,17 | 454 | 6,02% |
| € 1.007.006 | Facility - Commitment Increase | 31-12-2016 | 23922 | Cash flow - out | 1.006 -€ | 465 | 6,02% |
| € 1.007.006 | Loan - Interest Payment | 31-1-2017 | 23922 | Cash flow - in | € 5.454,62 | 486 | 6,02% |
| € 1.007.006 | Loan - Interest Payment | 28-2-2017 | 23922 | Cash flow - in | € 5.454,62 | 512 | 6,02% |
| € 1.007.006 | Loan - Interest Payment | 31-3-2017 | 23922 | Cash flow - in | € 5.454,62 | 559 | 6,02% |
| € 1.007.006 | Loan - Interest Payment | 30-4-2017 | 23922 | Cash flow - in | € 5.454,62 | 574 | 6,02% |
| € 1.007.006 | Loan - Interest Payment | 31-5-2017 | 23922 | Cash flow - in | € 5.454,62 | 601 | 6,02% |
| € 1.007.006 | Loan - Interest Payment | 30-6-2017 | 23922 | Cash flow - in | € 5.454,62 | 634 | 6,02% |
| € 0 | Loan - Interest Payment | 31-7-2017 | 23922 | Cash flow - in | € 3.818,23 | 651 | 6,02% |
| € 0 | Facility - Paydown | 31-7-2017 | 23922 | Cash flow - in | € 1.007.006 | 662 | 6,02% |
8 Replies
- v-yalanwu-msft
Community Support
Hi, Anonymous ;
You could try to create a column as follow:
Gross IRR3 = VAR minIndex = CALCULATE ( MIN ( 'TEST - Working Capital'[Index] ), ALL ( 'TEST - Working Capital' ) ) RETURN IF ( 'TEST - Working Capital'[Index] > minIndex, CALCULATE ( XIRR ( 'TEST - Working Capital', 'TEST - Working Capital'[Cash flow amount], 'TEST - Working Capital'[Transaction Date] ), FILTER ( ALLSELECTED ( 'TEST - Working Capital' ), EARLIER( 'TEST - Working Capital'[Index] ) >= 'TEST - Working Capital'[Index] ) ) )The final show:
For reference:
Solution to XIRR with Terminal Values
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- AnonymousNot applicable
Hi Yalan Wu,
Thank you for your reply. It's unfortunately not working with my pbix file. I do exactly the same but I still got an error. What do I do wrong?
Next to this, this is not per project (column Security/Facility HID). For now it's a rolling total.
- v-yalanwu-msft
Community Support
Hi, Anonymous ,
May be ALLSELECTED();
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. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- AnonymousNot applicable
Hi v-yalanwu-msft ,
Didn't work either unfortunately. Thanks a lot for helping!
Link to the simplified Pbix file:
https://drive.google.com/drive/folders/115tFcVio8vGoUNPjSGtP4XYiFh6yR3qe?usp=sharing
- v-yalanwu-msft
Community Support
Hi, Anonymous ;
You data is can't return vaild, if i change one value and filter little data,it will correct,XIRR Function (DAX) states: If the calculation fails to return a valid result, an error or value specified as alternateResult is returned.
https://www.microsoft.com/videoplayer/embed/RWLzrC
Or change it .
Gross IRR3 = VAR minIndex = CALCULATE ( MIN ( 'TEST - Working Capital'[Index] ), ALL ( 'TEST - Working Capital' ) ) RETURN IF ( 'TEST - Working Capital'[Index] > minIndex, CALCULATE ( XIRR ( 'TEST - Working Capital', 'TEST - Working Capital'[Cash flow amount], 'TEST - Working Capital'[Transaction Date],0.1,-0.99 ), FILTER ( ALLSELECTED ( 'TEST - Working Capital' ), EARLIER( 'TEST - Working Capital'[Index] ) >= 'TEST - Working Capital'[Index] ) ) )
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- AnonymousNot applicable
Hi v-yalanwu-msft ,
Why can't my data return valid? The data I send in the message above is exactly the same as in the shared pbix file and you got no error but I do got an error.
Regards, Toon
- v-yalanwu-msft
Community Support
Hi, Anonymous ;
https://www.microsoft.com/videoplayer/embed/RWLzrC
As you can see in the video above, our numbers are different.
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.