Forum Discussion
Sum used in expression for sumx
- 8 years ago
Hi saranee
This is one of the features of CALCULATE.. it transforms ROW CONTEXT into FILTER CONTEXT
To test it....just add these two simple calculated columns in your above TABLE... Both will give different results
Column1 =sum('Table'[Salary])Column2=CALCULATE(sum('Table'[Salary]))
Simialry...inside an ITERATOR.... these two expressions behave differently
Hi saranee
Actually SUMX is an iterator. Iterators provide ROW context but not the filter context.....
So it behaves like a calculated column....i.e when you write SUM(Column) in a calculated column ...it sums the entire Table without taking into account filters like Row Filters, Column Filters, Slicers.
But when you wrap it inside CALCULATE... this ROW context is transformed into FILTER context
- saranee8 years agoHelper I
Thanks Zubair for explanation but when I am using Calculate I am not using any filter in it,Sorry I am not having much idea about dax.
Thanks,
Saranee
- Zubair_Muhammad8 years agoCommunity Champion
Hi saranee
This is one of the features of CALCULATE.. it transforms ROW CONTEXT into FILTER CONTEXT
To test it....just add these two simple calculated columns in your above TABLE... Both will give different results
Column1 =sum('Table'[Salary])Column2=CALCULATE(sum('Table'[Salary]))
Simialry...inside an ITERATOR.... these two expressions behave differently