cancel
Showing results for
Did you mean:

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Helper I

## Subtotals in Matrix with Hierarchy not adding up

Hello everyone,

I'm struggling to solve this problem !

So, I have this hierarchy in matrix with 2 level between two table linked with column "City"

level 1 : "RESP CONTENT"

level2 : "City"

I created the matrix as below as below using as hierarchy the columns of "table 1" :  "RESP CONTENT" and "City"

With :

CM = SWITCH (
TRUE,
HASONEVALUE(table1[City]) && HASONEVALUE(table1[RESP CONTENT]),
[Score],
NOT(HASONEVALUE(table1[City])) && HASONEVALUE(table1[RESP CONTENT]),
SUMX(VALUES(table1[City]),[Score]),
SUMX(VALUES(table1[City]),[Score])
)

Everything works but when I remove the filter of "RESP CONTENT" the total of level 1 "RESP CONTENT" is wrong as below :

1 ACCEPTED SOLUTION
Community Support

HI @SoufTC,

I think you need to add if statements to check all hierarchy levels and write corresponding expressions for each level aggregation.

Clever Hierarchy Handling in DAX - SQLBI

Measure Totals, The Final Word

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
3 REPLIES 3
Super User

@SoufTC , as Score is measure

then for sum

sumx(Table, [Score])

or Sumx(values(Table[Column]), [Score])  // After Column, any group by it will sum

Helper I

@amitchandak  thank you but it only works for level 2 !

Community Support

HI @SoufTC,

I think you need to add if statements to check all hierarchy levels and write corresponding expressions for each level aggregation.

Clever Hierarchy Handling in DAX - SQLBI

Measure Totals, The Final Word

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.