SUMX producing wrong result when filtered in both row context and filter context
SUMX is an iteration function in Power BI that works on a row-by-row calculation per the given expression or equation. This function considers each row at a time and applies the calculation. It will not concentrate on the entire column, unlike the SUM function. But, it works like a cell be cell formula in Excel. SUM is an aggregate function, and SUMX is an expression function. One can perform Power BI data manipulation by using DAX functions, and SUMX is one such function in Power BI.
The SUMX function takes as its first argument a table, or an expression that returns a table. The second argument is a column that contains the numbers you want to sum, or an expression that evaluates to a column.
-
Only the numbers in the column are counted. Blanks, logical values, and text are ignored.
-
For more complex examples of SUMX in formulas, see ALL and CALCULATETABLE.
-
This function is not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules.