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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Reetz
Helper II
Helper II

Matrix totals are not correct

Capture.PNGHI all,  Have been messing around with this way too long.  I think I need a sumx but can't get this to work.

I have a matrix that is not showing totals correctly. 

 

If m_base sales are less than zero, I don't want to include them in my total.  I created a new measure called m_base sales 2 with an if statement, but the totals are the same for both columns.  Help!!!  

 

m_base sales2 =
VAR CurrentStartDate =
DATE ( 2018, 12, 31 )
VAR CurrentEndDate =
DATE ( 2019, 10, 01 )
VAR Basesales =
CALCULATE (
SUM ( 'a_table'[Sales] ),
'a_table'[Transaction Date] >= CurrentStartDate,
'a_table'[Transaction Date] < CurrentEndDate
)
RETURN
IF ( basesales > 0, basesales, 0 )

 

m_base sales =
VAR CurrentStartDate =
DATE ( 2018, 12, 31 )
VAR CurrentEndDate =
DATE ( 2019, 10, 01 )
VAR Basesales =
CALCULATE (
SUM ( 'a_table'[ Sales] ),
'a_table'[Transaction Date] >= CurrentStartDate,
'a_table'[Transaction Date] < CurrentEndDate
)
RETURN
Basesales


2 REPLIES 2
Anonymous
Not applicable

Well, it's easy. You have to loop over accounts:

 

[m_base sales2] =
SUMX(
	Account,
	var __sales = [m_base sales]
	RETURN
		(__sales > 0) * __sales
)

 

Best

luapdoniv
Resolver II
Resolver II

Here is quick workaround:
Screenshot_6.jpg

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.