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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
BILearner
Advocate I
Advocate I

Measure to Sum specific rows and the subtotal/grand total to still display the Actual Total Sales

Hi Power BI Community,

I have a table displayed like below, with column definitions as follows.

Tot Sales = Sum(Sales)
My Formula = Is my attempt to get the expected result.
Expected Result = How I want the calculation to work. 

 Combine Two Rows.jpg

 

 Here is the DAX I wrote 


SUMX(SUMMARIZE(SalesFact,'Territory'[Territory ID],'Product'[Sales Role]),IF('Product'[Sales Role]="Cat 1 Rep",CALCULATE([Total Sales],'Product'[Cat 1 Product]="YES",ALL('Product')),IF('Product'[Sales Role]="Cat 2 Rep",CALCULATE([Total Sales],'Product'[Cat 2 Rep Product]="YES"),CALCULATE([Total Sales],'Product'[Cat 3 Rep Product]="YES"))))

The above formula gives me the expected result against the Cat 1 Rep row, but fails to get the expected sub total and grand total. 

The field "Cat 1 Rep Product" in above formula is a flag which identifies products from product table that fall into Cat 1.
"Cat 2 Rep Product" and "Cat 3 Rep Product" are similar columns.
   
What I want is - Sum the results for Cat 1 Rep row and Cat 2 Rep row and display it against the Cat 1 rep, other rows shouldn't be impacted. Also, I do not want this manipulation to impact the Column subtotal or grand total and should display the actual total that is (Cat 1 Rep Product + Cat 2 Rep Product + Cat 3 Rep Product) and
NOT ( (Cat 1 Rep Product + Cat 2 Rep Product) + Cat 2 Rep Product + Cat 3 Rep Product).  

Is this possible? 

Thank you all! 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User
1 REPLY 1
amitchandak
Super User
Super User

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors