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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Conditional Sum for Certain Values in a Column

Hi all, I've been trying to work on a conditional sum for certain values of a column, but I'm having some trouble getting to work correctly. 

 

This is essentially what my data looks like: 

Forecast Start Date Value Date Business Division 1 Business Division 2 Business Division 3 Value Type Group Value Type Value

3/31/20193/31/2019Investment BankingIB USAIB US Fund 1RevenueBase Fee187
3/31/20196/30/2019Investment BankingIB USAIB US Fund 1RevenueBase Fee208
3/31/20199/30/2019Investment BankingIB USAIB US Fund 1RevenueBase Fee490
3/31/201912/31/2019Investment BankingIB USAIB US Fund 1RevenueBase Fee482
3/31/20193/31/2020Investment BankingIB USAIB US Fund 1RevenueBase Fee169
3/31/20196/30/2020Investment BankingIB USAIB US Fund 1RevenueBase Fee332
3/31/20193/31/2019Investment BankingIB USAIB US Fund 1RevenuePerformance Fee375
3/31/20196/30/2019Investment BankingIB USAIB US Fund 1RevenuePerformance Fee439
3/31/20199/30/2019Investment BankingIB USAIB US Fund 1RevenuePerformance Fee351
3/31/201912/31/2019Investment BankingIB USAIB US Fund 1RevenuePerformance Fee173
3/31/20193/31/2020Investment BankingIB USAIB US Fund 1RevenuePerformance Fee381
3/31/20196/30/2020Investment BankingIB USAIB US Fund 1RevenuePerformance Fee445
3/31/20193/31/2019Investment BankingIB USAIB US Fund 1BalanceAssets Under Management359
3/31/20196/30/2019Investment BankingIB USAIB US Fund 1BalanceAssets Under Management121
3/31/20199/30/2019Investment BankingIB USAIB US Fund 1BalanceAssets Under Management401
3/31/201912/31/2019Investment BankingIB USAIB US Fund 1BalanceAssets Under Management197
3/31/20193/31/2020Investment BankingIB USAIB US Fund 1BalanceAssets Under Management187
3/31/20196/30/2020Investment BankingIB USAIB US Fund 1BalanceAssets Under Management220
3/31/20193/31/2019Investment BankingIB USAIB US Fund 1BalanceNet Cash Flow482
3/31/20196/30/2019Investment BankingIB USAIB US Fund 1BalanceNet Cash Flow396
3/31/20199/30/2019Investment BankingIB USAIB US Fund 1BalanceNet Cash Flow393
3/31/201912/31/2019Investment BankingIB USAIB US Fund 1BalanceNet Cash Flow431
3/31/20193/31/2020Investment BankingIB USAIB US Fund 1BalanceNet Cash Flow424
3/31/20196/30/2020Investment BankingIB USAIB US Fund 1BalanceNet Cash Flow360

 

 
 
 

 

The data is of Revenue and Balance forecasts. The forecasts predict 5 Quarters worth of future data. The issue arises when I'm trying to put these forecasts into a matrix visualization. 

 

I have a slicer for the Value Type field. Same thing for the year. When I select "Assets Under Management", I would like for only the End-Of-Year value to be displayed. This is because Assets Under Management is a balance. It can't be summed up like the other values can be, because that wouldn't make sense. I would also like the Net Cash Flow values for the year to be added up into the End-Of-Year AUM if both "Net Cash Flow" and "Assets Under Management" are selected. 

 

For Revenue values, it's a simple CALCULATE(SUM()). But it's the Balance values that are giving me trouble. Does anyone know how I would write this measure to include that logic? What I tried doing is writing a SWITCH() and having the CALCULATE(SUM()) function be filtered for only MONTH(Revenue Date) = 12 if SELECTEDVALUE of Value Type is AUM, but that didn't work. That also doesn't take account for what happens when we're looking at an End-Of-Forecast Balance value. By that I mean, what if we select the year 2020? There's no forecast for December (Q4) in that year, the forecast ends on Q2. It makes sense to display that as the "End-Of-Year" balance, but I'm not sure how to do that. 

 

I'd appreciate any insights. Thank you!

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@Anonymous You can essentially do a SUMIF using the filter clause of CALCULATE (you don't generally need to wrap a simple SUM in CALCULATE without a filter clause btw). Like CALCULATE(SUM(), [Date] = DATE(2022,12,31)) or you can do it like this:

MAXX(FILTER('Table',[Date] = DATE(2022,12,31),[some column])

If you are going to get a single row returned from the filter then any X aggregator will do, MAXX, MINX, SUMX, etc.



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...

View solution in original post

1 REPLY 1
Greg_Deckler
Community Champion
Community Champion

@Anonymous You can essentially do a SUMIF using the filter clause of CALCULATE (you don't generally need to wrap a simple SUM in CALCULATE without a filter clause btw). Like CALCULATE(SUM(), [Date] = DATE(2022,12,31)) or you can do it like this:

MAXX(FILTER('Table',[Date] = DATE(2022,12,31),[some column])

If you are going to get a single row returned from the filter then any X aggregator will do, MAXX, MINX, SUMX, etc.



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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.