1
SUMX(TBLNAME, 1)

SUMX(ALL(TBLNAME), 1)

SUMX(ALL(TBLNAME[COLNAME]), 1)

Does table expansion happen only in 1st and 2nd example? What about the 3rd example. Is there any general list of situations when table expansion occurs?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
variable
  • 8,262
  • 9
  • 95
  • 215

1 Answers1

1

The table expansion happens for tables. When single columns are specified, there is no table expansion. Therfore for sample 3 there is no table expansion.

Assuming to have a model with a one to many relationship between table D and table F (on column ID) and a measure M

In a visual with D[cd] on the rows, the forumula

CALCULATE( [M], FILTER (ALL(F), F[cf] = val) )

uses expanded table therefore removing any existing filter over D

the formula

CALCULATE( [M], FILTER (ALL(F[cf]), F[cf] = val) )

instead only affects F[cf] column and doesn't affect filters over D table

sergiom
  • 4,791
  • 3
  • 24
  • 32
  • Usually does expansion happen when SUMX is used? I imagine that it does because that is how it has access to the related coloumns? – variable Jan 13 '21 at 17:15
  • Yes, when the first parameter of SUMX is a table,like for instance in SUMX( T, ... ) or SUMX( ALL( T ) ....) it is expanded. – sergiom Jan 13 '21 at 17:36
  • Also, in following case- CALCULATE ( SUM(T[C]) , filter), table T does get expanded. Otherwise how would CALCULATE perform the filter. Do you agree? – variable Jan 13 '21 at 19:30
  • Yes, it can be seen as the filter that operates over the expanded table. But I think it's important to add that the expanded table is an abstract concept: it is not actually materialized in memory. – sergiom Jan 13 '21 at 23:31