Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
giordani2000
Helper I
Helper I

Sum an array excluding last date (dax formula)

Team, I am trying to sum an array of cash flows including several filters. Here is my initial formula but I need to exclude the last cashflow activity which I can do excluding a date. Thanks for your help.

 

Interpretation: sum all cashflows, cashflows greater than zero, allexcept a date (this is the part that is not working),filter company names included in both tables (Summary3 and NewCF2)

 

'=CALCULATE(SUM(NewCF2[Cashflow$]), NewCF2[Cashflow$]>0,ALLEXCEPT(NewCF2,(NewCF2[Date])),filter(

ALL(NewCF2),

CONTAINS(

VALUES(Summary3),Summary3[Portfolio Company],NewCF2[Company])

)

)'

1 ACCEPTED SOLUTION
giordani2000
Helper I
Helper I

@Greg_Deckler I found out that I had last cashflow activities with the same date (last date) as the end of the period balance (which is calculated at the last date). Therefore, I decided to create a two columns: column 1 ($ activities), column 2 (end of the month balance). This solved one problem but I have two more problems. Below I pasted two tables and a screenshots of the measeures I created.

1) The first challenge I have is a measure totals problem (see last screen shot belo) that may be solved with HASONEFILTER. I tried implementing it in the Loss Amount Measure but not sure I did it right. (see #1 and #2)

2) The second challenge is that a measure I created (XIRR) is resulting in inconsistent results (see #3 and #4). For all the companies except Sym the measure seems to be working. I check the data and it seems to be fine as well but when I do a simple xirr calculation outside of the pivot table I get -69% but the pivot table doesn't. Hopefully this is in the scope of your expertise. Thanks for your help!. 

Here are the measures created:

giordani2000_1-1670872857795.png

Here are the 2 tables:

testsum

giordani2000_2-1670872912113.png

 

TestCF

giordani2000_3-1670872939812.png

 

Here is the output:

giordani2000_0-1670872826006.png

 

 

 

View solution in original post

2 REPLIES 2
giordani2000
Helper I
Helper I

@Greg_Deckler I found out that I had last cashflow activities with the same date (last date) as the end of the period balance (which is calculated at the last date). Therefore, I decided to create a two columns: column 1 ($ activities), column 2 (end of the month balance). This solved one problem but I have two more problems. Below I pasted two tables and a screenshots of the measeures I created.

1) The first challenge I have is a measure totals problem (see last screen shot belo) that may be solved with HASONEFILTER. I tried implementing it in the Loss Amount Measure but not sure I did it right. (see #1 and #2)

2) The second challenge is that a measure I created (XIRR) is resulting in inconsistent results (see #3 and #4). For all the companies except Sym the measure seems to be working. I check the data and it seems to be fine as well but when I do a simple xirr calculation outside of the pivot table I get -69% but the pivot table doesn't. Hopefully this is in the scope of your expertise. Thanks for your help!. 

Here are the measures created:

giordani2000_1-1670872857795.png

Here are the 2 tables:

testsum

giordani2000_2-1670872912113.png

 

TestCF

giordani2000_3-1670872939812.png

 

Here is the output:

giordani2000_0-1670872826006.png

 

 

 

Greg_Deckler
Super User
Super User

@giordani2000 Try setting a VAR __MaxDate = MAX('Table'[Date]) and then using that in your filter clause?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.