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

Getting the proportion of a subcategory inside the larger category

Hello,

 

I've been working on this problem for a week I'm fairly new to DAX so I figure that ther is problem a really simple solution that I am just not thinking of.

 

At my job we have often have to rework parts to make them usable because of this we have several different cateogries of rework. I want to calculate the proportion of rework types that we have each part as a stacked bar chart. I tried using using Divide([Count of Rework categories], [Count of part number]) which gives me the correct answe but once I start to slice the data it no longer gives me the values out of 100%. How can I set it up so that the data filters in correctly for the the problem I'm working on. 

 

If that what I'm asking is confusing here is an example of some fake data that and  the outputs that I am looking for.

 

slxa_0-1601221018311.pngslxa_1-1601221051313.png

 

 

Thank you all for your help

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try new measures like


divide(count(Table[Reworkcategory]), calculate(count(Table[Reworkcategory]),allexcept(Table,Table[Part])))

or

divide(count(Table[Reworkcategory]), calculate(count(Table[Reworkcategory]),Filter(allselected(Table),Table[Part] =max(Table[Part]))))

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Try new measures like


divide(count(Table[Reworkcategory]), calculate(count(Table[Reworkcategory]),allexcept(Table,Table[Part])))

or

divide(count(Table[Reworkcategory]), calculate(count(Table[Reworkcategory]),Filter(allselected(Table),Table[Part] =max(Table[Part]))))

Anonymous
Not applicable

@amitchandak 

 

Thank you so much for your help!

I was grinding away at that forever.

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.

Top Solution Authors