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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Sum of total and subtotal based on rows in matrix view

Hi Team

 

 I am creating a matrix view with below data.

RatanBhushan_0-1627355961496.png

Matrix View

RatanBhushan_2-1627356066674.png

 

Dax which I have used to create the profit is 

Profit = SUMx(Sales,Sales[Sales]*0.05)
 
My query is - if I want to have different percentage condition for Region in same dax profit code - lets say for now it is calculating for all 5%, but when its shows for region subtotal - it should be 4.8% in the same profit column.
 
Is it possible by any ways? Please help.
 
Thanks and regards
RatanB
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try like

 

Profit = Switch( True() ,

not(Isinscope(Table[Country])) , SUMx(Sales,Sales[Sales]*0.048)

SUMx(Sales,Sales[Sales]*0.05)

)

 

Try to use isinscope

https://www.kasperonbi.com/use-isinscope-to-get-the-right-hierarchy-level-in-dax/

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

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Try like

 

Profit = Switch( True() ,

not(Isinscope(Table[Country])) , SUMx(Sales,Sales[Sales]*0.048)

SUMx(Sales,Sales[Sales]*0.05)

)

 

Try to use isinscope

https://www.kasperonbi.com/use-isinscope-to-get-the-right-hierarchy-level-in-dax/

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
Anonymous
Not applicable

RatanBhushan_0-1627361957273.png

Could you please advise what line I should write in order to get "TOTAL" in "checking" column in front of "TOTAL" in region column?

 

Thanks and regards 

Anonymous
Not applicable

Let me check this in bigger data and multiple columns. the solution which you provided for the above data set, worked like cream. Kudos to you. Thanks a ton

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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.