Forum Discussion
visheshvats1
1 year agoHelper I
Sorting the temporary table
Hello, Trying to calculate XIRR, but the result varies even on the sort order of values. My DAX to calculate a table, and use it to calculate XIRR is as follows: Output is : ...
- 1 year ago
I managed to sort the dynamic table within my measure. I needed to create a caculated column which has 0 if the sum of Net is zero for a given date for any deal name. Create another column to be 1 if value in this new column is <0 else 2.
Now split into 3 parts and then combine using union function.
My measure:VAR _Table = UNION(SELECTCOLUMNS(FILTER('General Ledger','General Ledger'[GL Date] >= [MIN Date] &&'General Ledger'[GL Date] <= [MAX Date] &&'General Ledger'[Trans Type] IN Trantype&&'General Ledger'[Column]<>0&&'General Ledger'[Index]=1),"GL Date", 'General Ledger'[GL Date],"Net", 'General Ledger'[Column]),SELECTCOLUMNS(FILTER('General Ledger','General Ledger'[GL Date] >= [MIN Date] &&'General Ledger'[GL Date] <= [MAX Date] &&'General Ledger'[Trans Type] IN Trantype&&'General Ledger'[Column]<>0&&'General Ledger'[Index]=2),"GL Date", 'General Ledger'[GL Date],"Net", 'General Ledger'[Column]),ROW("GL Date", [MAX Date],"Net", [Net sheet 1]))RETURNXIRR(_Table,[Net],[GL Date],-0.1,0)
visheshvats1
1 year agoHelper I
Min date = min(GL Date)
Max date = 9/30/2024
Trans Type filters:
| Trans Types | |
| For Cash Flows(Net): credits only - debits only | For NAV (Net Sheet 1): debits only - credits only |
| Accrued portfolio dividend receivable, | Accumulated Depreciation, |
| Accrued Rental Income, | Acquisition Adjustment, |
| Bond - interest receivable, | Adjustment- do not post, |
| Capitalized fee/expense, | Adjustment- do not post (Recallable), |
| Distribution - Current income - (Recallable), | Bond - interest receivable, |
| Distribution - Current income (Non-Recallable), | Bonus Shares, |
| Dividend Income - Recallable, | Capitalized fee/expense, |
| Gain: realized f/x, long term - FOF, | Distribution - Current income - (Recallable), |
| Gain: realized, long term - FOF, | Distribution - Current income (Non-Recallable), |
| Income: dividend - cash, | Dividend Income - Recallable, |
| Income: dividend - pik, | Investment Property, |
| Income: dividend accrual, | Loan - Interest Receivable, |
| Income: fees, investment, | Loan Receivable, |
| Income: interest - cash, investment, | Purchase, |
| Income: interest - pik, | Purchase - FOF - Call for Fund Expenses (aff Cmt), |
| Income: interest accrual, | Purchase - FOF - Call for Fund Expenses (Not aff Cmt), |
| Income: other, investment, | Purchase - FOF - Call for Investments, |
| Investment Property, | Purchase - FOF - Call for Management Fees (aff Cmt), |
| Investments Payable, | Purchase - FOF - Call for Management Fees (Not aff Cmt), |
| Investments Receivable, | Purchase - FOF - Call for Operational Expenses (aff Cmt), |
| Loan - Interest Receivable, | Purchase - FOF - Call for Operational Expenses (Not aff Cmt), |
| Loan Receivable, | Purchase: PIK, |
| Loss: realized f/x, long term, | Purchase: security conversion, |
| Loss: realized f/x, long term, | Realized Gains/Losses - FOF (Non Recallable), |
| Loss: realized, long term, | Realized Gains/Losses - FOF (Recallable), |
| Other receivable, | Receivable: interest, |
| Purchase, | Receivable: interest, accrued, |
| Purchase - FOF - Call for Fund Expenses (aff Cmt), | Return of capital, |
| Purchase - FOF - Call for Fund Expenses (Not aff Cmt), | Return of Capital - FOF (Non Recallable), |
| Purchase - FOF - Call for Investments, | Return of Capital - FOF (Recallable), |
| Purchase - FOF - Call for Management Fees (aff Cmt), | Return of capital: stock distribution to partners, |
| Purchase - FOF - Call for Management Fees (Not aff Cmt), | Return of Excess Contributions, |
| Purchase - FOF - Call for Operational Expenses (aff Cmt), | Sell, |
| Purchase - FOF - Call for Operational Expenses (Not aff Cmt), | Sell- do not use, |
| Purchase: PIK, | Unrealized appreciation/depreciation, |
| Purchase: security conversion, | Unrealized depreciation, |
| Realized Gains/Losses - FOF (Non Recallable), | Unrealized f/x appreciation/depreciation |
| Realized Gains/Losses - FOF (Recallable), | |
| Receivable: interest, | |
| Receivable: interest, accrued, | |
| Rental income, | |
| Return of capital, | |
| Return of Capital - FOF (Non Recallable), | |
| Return of Capital - FOF (Recallable), | |
| Return of capital: stock distribution to partners, | |
| Return of Excess Contributions, | |
| Sell, | |
| Withholding tax on Dividend |
Data:
|
visheshvats1
1 year agoHelper I
I managed to sort the dynamic table within my measure. I needed to create a caculated column which has 0 if the sum of Net is zero for a given date for any deal name. Create another column to be 1 if value in this new column is <0 else 2.
Now split into 3 parts and then combine using union function.
My measure:
VAR _Table = UNION(
SELECTCOLUMNS(
FILTER(
'General Ledger',
'General Ledger'[GL Date] >= [MIN Date] &&
'General Ledger'[GL Date] <= [MAX Date] &&
'General Ledger'[Trans Type] IN Trantype&&
'General Ledger'[Column]<>0&&
'General Ledger'[Index]=1
),
"GL Date", 'General Ledger'[GL Date],
"Net", 'General Ledger'[Column]
),
SELECTCOLUMNS(
FILTER(
'General Ledger',
'General Ledger'[GL Date] >= [MIN Date] &&
'General Ledger'[GL Date] <= [MAX Date] &&
'General Ledger'[Trans Type] IN Trantype&&
'General Ledger'[Column]<>0&&
'General Ledger'[Index]=2
),
"GL Date", 'General Ledger'[GL Date],
"Net", 'General Ledger'[Column]
),
ROW(
"GL Date", [MAX Date],
"Net", [Net sheet 1]
))
RETURN
XIRR(_Table,[Net],[GL Date],-0.1,0)