Forum Discussion
mvananaken
Helper II
9 years agoIF SUMX / Calculate row total issue
Hello Folks, I got a example table with: Date Employee hours 2016-01-01 Employee A 8 2016-01-01 Employee A 8 I'm looking for a measure where the Sum...
- 9 years ago
Try with this :
MaximumTotalHours = SUMX ( ADDCOLUMNS ( SUMMARIZE ( 'Table', 'Table'[Date], 'Table'[Employee] ), "TOTALHOURS", IF ( CALCULATE ( SUM ( 'Table'[Hours] ) ) >= 8, 8, CALCULATE ( SUM ( 'Table'[Hours] ) ) ) ), [TOTALHOURS] )and for better performance in large datasets, combine both measure
HoursCalc = IF ( HASONEVALUE ( 'Table'[Date] ), [Maximum], [MaximumTotalHours]
LaurentCouartou
Solution Supplier
9 years agoYou probably missed a coma somewhere. As it says, you need 2 arguments for this function to work.
Vvelarde
Community Champion
9 years ago
Try with this :
MaximumTotalHours =
SUMX (
ADDCOLUMNS (
SUMMARIZE ( 'Table', 'Table'[Date], 'Table'[Employee] ),
"TOTALHOURS", IF (
CALCULATE ( SUM ( 'Table'[Hours] ) ) >= 8,
8,
CALCULATE ( SUM ( 'Table'[Hours] ) )
)
),
[TOTALHOURS]
)and for better performance in large datasets, combine both measure
HoursCalc = IF ( HASONEVALUE ( 'Table'[Date] ), [Maximum], [MaximumTotalHours]
- mvananaken9 years ago
Helper II