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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Shenee
Helper I
Helper I

how to divide subcategory sum by category total

Hi Guys,

Anyone know how I can create measures that give the percentage figures as shown in the pivot table below? The category totals are 125 and 275 and whenever i try to create a percentage total of each subcategory ie Plymouth or SHWD, it keeps dividing the subcategory numerator total by the respective subcategory denominator total (15, 110, 210 and 65). I need a measure that can divide the subcategory numerator total by the respective category denominator total instead (125 or 275) as shown on the pivot table. I have also included the pbix file and when you look at it, it shows the percentage figures for each subcategory when its numerator total is divided by the subcategory denominator total and this is not what i want to see. I need it to be abe to calculate the percentages just as it is on the pivot table.

Any help will be highly appreciated.

 

https://1drv.ms/u/s!AhEw68UYqcc6gx0mgWUJ4xXXbX7v?e=RtGyph 

 

pivot tablepivot table

2 ACCEPTED SOLUTIONS
HoangHugo
Solution Specialist
Solution Specialist

Hi try this

Measure =

 var cat =SELECTEDVALUE (category Column)

 return

  if(ISINSCOPE(sub-category Column),
                sum of numberator / CALCULATE(sum of denominator, REMOVEFILTER(sub-category column), category Column = cat),
 sum of numbertor/sum of denominator)

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you @Ashish_Mathur 

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

HoangHugo
Solution Specialist
Solution Specialist

Hi try this

Measure =

 var cat =SELECTEDVALUE (category Column)

 return

  if(ISINSCOPE(sub-category Column),
                sum of numberator / CALCULATE(sum of denominator, REMOVEFILTER(sub-category column), category Column = cat),
 sum of numbertor/sum of denominator)

Thank you @HoangHugo 

Your measure worked brilliantly!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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