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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
mf2499pbi
Frequent Visitor

Hierarchy Not Rolling Up As expected

Hi All, 

 

I am using a switch function to sum up values in a Power BI matrix, but the hierarchy is not rolling up as I expected it to. I am using a switch function to flip between the value I want for France and the values for the rest of countries. 

 

Here is my DAX:

Test Rollup  = switch(SELECTEDVALUE('Hierarchy'[level2]), "FRANCE", sum('Table'[Amount1])/1000, sum('Table'[Amount2] )/1000)
 
The Matrix seems to be only rolling up the values for the second argument in the switch function. I would the total to be 1,602.57 as France should be zero, but it is adding the value for Amount2 instead of Amount1. Does anyone know why this is? Please see image below and let me know if there are any questions. 
 
mf2499pbi_0-1667244920017.png

 

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @mf2499pbi 

Thanks for reaching out to us.

please try the measures below

Measure = SWITCH(SELECTEDVALUE('Table'[Column1]),"FRANCE",sum('Table'[amount1])/1000, sum('Table'[amount2] )/1000)
TEST = IF(HASONEFILTER('Table'[Column1]),[Measure],SUMX('Table',[Measure]))

then put measure [TEST] into matrix,

vxiaotang_0-1667898946687.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-xiaotang
Community Support
Community Support

Hi @mf2499pbi 

Thanks for reaching out to us.

please try the measures below

Measure = SWITCH(SELECTEDVALUE('Table'[Column1]),"FRANCE",sum('Table'[amount1])/1000, sum('Table'[amount2] )/1000)
TEST = IF(HASONEFILTER('Table'[Column1]),[Measure],SUMX('Table',[Measure]))

then put measure [TEST] into matrix,

vxiaotang_0-1667898946687.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@mf2499pbi , Try like

Test Rollup =

Sumx(Values(('Hierarchy'[level2] ) , calculate(switch(SELECTEDVALUE('Hierarchy'[level2]), "FRANCE", sum('Table'[Amount1])/1000, sum('Table'[Amount2] )/1000)) ))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.