cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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.

Thank you all for your help

1 ACCEPTED SOLUTION
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]))))

2 REPLIES 2
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

Thank you so much for your help!

I was grinding away at that forever.

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.