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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

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
Community Champion
Community Champion

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



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors
Top Kudoed Authors