Forum Discussion
Selected Value Blank
Thank you, sturlaws! This helped me solve a similar issue.
I had created a numeric measure using SUM() and a filter for [field] = SELECTEDVALUES([other field]).
Individual rows were returning the expected SUM() in my matrix visualization (since [other field] would have a single value within a single row's row context).
However, the Total row in the matrix was blank. I figured out this was due to the fact that the row context for the Total row would have multiple values for [other field] and, therefore, SELECTEDVALUE([other field]) in that row context would return null and, therefore, the SUM() was null.
After reading your post, I was able to update my formula to filter by IN VALUES([other field] and now my SUM(), SUMX() actually, is returning the correct, summed values for the Total row.
FilteredSum =
/* Create a one-column table of Table1 key values for the current row context.
* (This method, using VALUES() instead of SELECTEDVALUE() to get the value for the
* current row/row context, is necessary in order to SUM() the measure when
* there could be multiple "selected values" within the "Total" row context.) */
VAR t1KeyValues = VALUES('Table1'[T1_KEY])
RETURN
SUMX(
FILTER(
'Table2',
'Table2'[T2_KEY] IN t1KeyValues
),
[T2_VALUE_TO_SUM]
)