Reply
SoufTC
Helper I
Helper I
Partially syndicated - Outbound

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"

 

SoufTC_0-1646034995888.png

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 :
 
SoufTC_1-1646035447441.png

 

Please, any help?

Thank's in advance

1 ACCEPTED SOLUTION
avatar user
Anonymous
Not applicable

Syndicated - Outbound

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

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

Syndicated - Outbound

@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

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Syndicated - Outbound

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

avatar user
Anonymous
Not applicable

Syndicated - Outbound

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

avatar user

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)