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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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