Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
SoufTC
Helper I
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"

 

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

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.

View solution in original post

3 REPLIES 3
amitchandak
Super User
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

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

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

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.

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors
Top Kudoed Authors