Forum Discussion
Wrong total
Hi everybody
Ive got a problem with my total, which are wrong. The rows are correct.
If I filter the rows and removes the 0's, then the total is still wrong.
Can someone see what I am doing wrong here ?
Besparelsespotentiale (gulv) =
VAR _simuleringsfaktor = 2
VAR _segment = CALCULATE(AVERAGE(SegmentGBS[Gns. timepris pr segment]), SegmentGBS[Norma afdeling] = "Gulv") - _simuleringsfaktor
VAR _new100 = CALCULATE(SUM(SegmentGBS[Norma timer (inkl K-faktor)]), SegmentGBS[Norma afdeling] = "Gulv") * _segment * [Soc_omk_prc] * -1
VAR _old100 = CALCULATE(SUM(SegmentGBS[Ny løn indeks 100]), SegmentGBS[Norma afdeling] = "Gulv")
VAR _savings =
IF(
CALCULATE(AVERAGE(SegmentGBS[Gns. timepris]), SegmentGBS[Norma afdeling] = "Gulv") > _segment,
( _new100 - _old100 ) * '0_Konstanter'[Konservatisme Gulv],
0
)
RETURN
_savings
Typically this problem is because the calculation for the total line is not just adding up the individual lines, it is calculating the measure in the context of the total.
If you want to instead sum up the individual values, you need to create another measure which you will use in the visual instead of the current one, and this will depend on which column you are using the table or matrix visual. If you were using e.g. 'Table'[Column] in the visual, then you could create a measure like
Total Besparelsespotentiale (gulv) = SUMX( VALUES( 'Table'[Column] ), [Besparelsespotentiale (gulv)] )
2 Replies
- johnt75Super User
Typically this problem is because the calculation for the total line is not just adding up the individual lines, it is calculating the measure in the context of the total.
If you want to instead sum up the individual values, you need to create another measure which you will use in the visual instead of the current one, and this will depend on which column you are using the table or matrix visual. If you were using e.g. 'Table'[Column] in the visual, then you could create a measure like
Total Besparelsespotentiale (gulv) = SUMX( VALUES( 'Table'[Column] ), [Besparelsespotentiale (gulv)] ) - shafiz_pSuper User
Hi DK-C-87 Try this:
Besparelsespotentiale (gulv) = VAR _simuleringsfaktor = 2 VAR _segment = CALCULATE(AVERAGE(SegmentGBS[Gns. timepris pr segment]), SegmentGBS[Norma afdeling] = "Gulv") - _simuleringsfaktor VAR _new100 = CALCULATE(SUM(SegmentGBS[Norma timer (inkl K-faktor)]), SegmentGBS[Norma afdeling] = "Gulv") * _segment * [Soc_omk_prc] * -1 VAR _old100 = CALCULATE(SUM(SegmentGBS[Ny løn indeks 100]), SegmentGBS[Norma afdeling] = "Gulv") VAR _savings = IF( CALCULATE(AVERAGE(SegmentGBS[Gns. timepris]), SegmentGBS[Norma afdeling] = "Gulv") > _segment, ( _new100 - _old100 ) * '0_Konstanter'[Konservatisme Gulv], 0 ) RETURN SUMX( VALUES(SegmentGBS[Norma afdeling]), -- Change this column with the column you have used in the visual _savings )Hope this helps!!
If this solved your problem, please accept it as a solution and a kudos!!
Best Regards,
Shahariar Hafiz