Forum Discussion
SUMX(VALUES(column), [Measure]) returns parent-level value, while ADDCOLUMNS/SUMMARIZECOLUMNS works
- 4 months ago
I found the root cause.
The issue was caused by the semantic model setting Value filter behavior. In my case, this setting changed how filters were evaluated in the visual context, which is why SUMX(VALUES(...), [Measure]) produced unexpected parent-level repeated values.
This also explains why:
- adding hierarchy columns changed the result
- alternative patterns such as ADDCOLUMNS / SUMMARIZECOLUMNS behaved differently
So the problem was not the base measure itself, but the semantic model's Value filter behavior setting.
Here`s the documentation.I'm mistaken. The default value hasn't changed. I remember it's changed.I can't believe it's still on the preview
Work with value filter behavior in Power BI - Power BI | Microsoft Learn
I found a more specific trigger for this issue.
The abnormal behavior appears when the filter context contains two <> conditions. In that case, SUMX starts returning incorrect results in the visual.
It looks as if the related hierarchy field is being ignored during evaluation, and the measure returns the aggregated value with that field effectively removed from the grouping context.
I have included the related TMDL and screenshots for reference.
createOrReplace
model Model
culture: en-US
defaultPowerBIDataSourceVersion: powerBI_V3
sourceQueryCulture: en-us
dataAccessOptions
legacyRedirects
returnErrorValuesAsNull
table fact
lineageTag: 7fca3ae8-7286-4796-a52a-9d10adafc299
measure 'SUMX value' = SUMX(VALUES('dim'[MR]),[Sum Value])
formatString: 0
lineageTag: 28e43acd-668a-4722-b6e0-67e04b7cf220
measure 'Sum Value' = SUM('fact'[value])
formatString: 0
lineageTag: f2b30ab8-41f6-40ce-8838-7cbf0ef9dde2
column AD
dataType: string
lineageTag: 75a1d930-1f9c-46d3-bac5-bd770baddfb8
summarizeBy: none
sourceColumn: AD
annotation SummarizationSetBy = Automatic
column DM
dataType: string
lineageTag: 87c6d205-70e8-4f2a-b061-f9002ea107b4
summarizeBy: none
sourceColumn: DM
annotation SummarizationSetBy = Automatic
column RM
dataType: string
lineageTag: 6ce4ef2d-915b-4254-84ca-5c2d01b31e1e
summarizeBy: none
sourceColumn: RM
annotation SummarizationSetBy = Automatic
column MR
dataType: string
lineageTag: 97bfc23f-497a-4bde-b20f-f6d32b8a93da
summarizeBy: none
sourceColumn: MR
annotation SummarizationSetBy = Automatic
column Type
dataType: string
lineageTag: 78f19ce8-8760-499f-886c-63604c9b2710
summarizeBy: none
sourceColumn: Type
annotation SummarizationSetBy = Automatic
column value
dataType: int64
formatString: 0
lineageTag: 3114c629-3155-4539-97be-13f85ef0979d
summarizeBy: sum
sourceColumn: value
changedProperty = DataType
annotation SummarizationSetBy = Automatic
column yearmonth
dataType: string
lineageTag: c2c8cf03-ce1c-4a92-a7e7-bcec58fcaef8
summarizeBy: none
sourceColumn: yearmonth
annotation SummarizationSetBy = Automatic
column key = [yearmonth]&"_"&[MR]
lineageTag: 95208981-759c-433c-924d-7622c400bd49
summarizeBy: none
annotation SummarizationSetBy = Automatic
partition fact = m
mode: import
source =
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("7dO9CoQwDAfwd+msoGkr9xLncKs4FHqDoB4o3PObM/iBl9Z279J0yI+0/EnTCCigKkqRCWPzX7HDWiYqw7SW5wuPUoo2CwCwA7gBQEDeAyAgCahYoDegwvqrY4Dz0yfRjV/TdxZv9WfMZ9O/Z7xreZl2tFlyyBUNfLADITYWH2BjYcE1Fu1+U0AuPsDl4uvnc3EKPhe0fzw6mrQxaWPSxoRE0y4=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [yearmonth = _t, AD = _t, DM = _t, RM = _t, MR = _t, Type = _t, value = _t])
in
Source
annotation PBI_ResultType = Table
annotation PBI_NavigationStepName = Navigation
table dim
lineageTag: 82602666-1dbc-4d81-b193-a7d89f2a659d
column AD
lineageTag: 9843a712-e08a-4699-bb8f-6c22f6dcb7e3
summarizeBy: none
isNameInferred
sourceColumn: fact[AD]
columnOrigin: fact.AD
annotation SummarizationSetBy = Automatic
column yearmonth
lineageTag: eb88c63c-e204-4611-a676-8a7f38962004
summarizeBy: none
isNameInferred
sourceColumn: fact[yearmonth]
columnOrigin: fact.yearmonth
annotation SummarizationSetBy = Automatic
column RM
lineageTag: 93931e7f-a6c9-4b2e-ac19-159c553e7894
summarizeBy: none
isNameInferred
sourceColumn: fact[RM]
columnOrigin: fact.RM
annotation SummarizationSetBy = Automatic
column DM
lineageTag: 47734e27-6228-4551-a8e0-31a4856a942f
summarizeBy: none
isNameInferred
sourceColumn: fact[DM]
columnOrigin: fact.DM
annotation SummarizationSetBy = Automatic
column MR
lineageTag: 2edc28cb-a1c9-45b4-a3b3-e2774fc61aa1
summarizeBy: none
isNameInferred
sourceColumn: fact[MR]
columnOrigin: fact.MR
annotation SummarizationSetBy = Automatic
column key
lineageTag: 74299008-c329-487e-a46d-b4a71f740422
summarizeBy: none
isNameInferred
sourceColumn: [key]
annotation SummarizationSetBy = Automatic
column Type
lineageTag: 16cfe588-e599-4b48-8695-57939be91ad8
summarizeBy: none
isNameInferred
sourceColumn: fact[Type]
columnOrigin: fact.Type
annotation SummarizationSetBy = Automatic
partition dim = calculated
mode: import
source =
SUMMARIZE('fact'
,[yearmonth]
,[AD]
,[RM]
,[DM]
,[MR]
,[Type]
,"key",[yearmonth]&"_"&[MR]
)
annotation PBI_Id = 0c229d07a92d4a74bbef2f943e36314b
relationship 985514e0-0594-2b22-7af3-873d4de14e98
fromColumn: fact.key
toColumn: dim.key
cultureInfo en-US
annotation __PBI_TimeIntelligenceEnabled = 0
annotation PBI_QueryOrder = ["fact"]
- Xian-Zuo4 months agoFrequent Visitor
I found the root cause.
The issue was caused by the semantic model setting Value filter behavior. In my case, this setting changed how filters were evaluated in the visual context, which is why SUMX(VALUES(...), [Measure]) produced unexpected parent-level repeated values.
This also explains why:
- adding hierarchy columns changed the result
- alternative patterns such as ADDCOLUMNS / SUMMARIZECOLUMNS behaved differently
So the problem was not the base measure itself, but the semantic model's Value filter behavior setting.
Here`s the documentation.I'm mistaken. The default value hasn't changed. I remember it's changed.I can't believe it's still on the preview
Work with value filter behavior in Power BI - Power BI | Microsoft Learn