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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
agalbraith
Helper II
Helper II

How to get percent of categories for two separate groupings into one graph

I have two groups of data Group A and Group B where I need to get the percent of categories based on the total responses for each. There are multiple categories within each group all by the same name. I want to be able to display the correct % of categories for each group in one graph AND have it be able to connect back to my main data table in which other data on a page can interact with it.

I have tried making two separate tables for the groups and doing my measure for each which is fine, but then I need essentially an attribute key table in order to have the percentages for both groups to display correctly (since you can only put one attribute into the graph visual obviously). In doing this, then I cannot make a both way connection back to my main data table for both the group tables, it only allows for one both way connection at a time because of the key connected I am assuming. 

 

I have also tried merging the data together but the dax I would normally use for just one grouping of data does not work right. Mainly because there is not equal responses across the groups they have their individual response totals.

Here is my dax: %Percent of cases = DIVIDE(COUNTA(Table[Value]), CALCULATE(DISTINCTCOUNT(Table[ID]), ALLSELECTED(Table)))

 

What would be a solution to this? Am I merging them wrong? Am I connecting them wrong in the web? How could I update my dax to only reflect the response total per group A and B? The distinctcount for the ID column and the allselected are what I believe are wrong here I just don't know how to update it for my needs.

 

Here is example data as one table:

IDAttributeGroupAGroupB
R1Benefit111
R2Benefit11 
R3Benefit111
R4Benefit11 
R5Benefit211
R6Benefit211
R7Benefit211
R8Benefit311
R9Benefit311
R10Benefit41 
R11Benefit511
R12Benefit511
R13Benefit511
R14Benefit61 
R15Benefit61 

 

 

1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @agalbraith ,

 

1. You can use the small multiples to split a visual into multiple versions of itself.

 

GroupA% = 
DIVIDE (
    CALCULATE ( COUNT ( 'Table'[ID] ), 'Table'[GroupA] = 1 ),
    COUNTX ( ALL ( 'Table' ), 'Table'[ID] )
)
GroupB% = 
DIVIDE (
    CALCULATE ( COUNT ( 'Table'[ID] ), 'Table'[GroupB] = 1 ),
    COUNTX ( ALL ( 'Table' ), 'Table'[ID] )
)

vkkfmsft_0-1647839271609.png

 

2. Or unpivot [GroupA] and [GroupB], then create the measure.

 

vkkfmsft_1-1647839455854.png

Measure = 
DIVIDE (
    DISTINCTCOUNT ( 'Table (2)'[ID] ),
    CALCULATE ( DISTINCTCOUNT ( 'Table (2)'[ID] ), ALL ( 'Table (2)' ) )
)

vkkfmsft_2-1647839568258.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-kkf-msft
Community Support
Community Support

Hi @agalbraith ,

 

1. You can use the small multiples to split a visual into multiple versions of itself.

 

GroupA% = 
DIVIDE (
    CALCULATE ( COUNT ( 'Table'[ID] ), 'Table'[GroupA] = 1 ),
    COUNTX ( ALL ( 'Table' ), 'Table'[ID] )
)
GroupB% = 
DIVIDE (
    CALCULATE ( COUNT ( 'Table'[ID] ), 'Table'[GroupB] = 1 ),
    COUNTX ( ALL ( 'Table' ), 'Table'[ID] )
)

vkkfmsft_0-1647839271609.png

 

2. Or unpivot [GroupA] and [GroupB], then create the measure.

 

vkkfmsft_1-1647839455854.png

Measure = 
DIVIDE (
    DISTINCTCOUNT ( 'Table (2)'[ID] ),
    CALCULATE ( DISTINCTCOUNT ( 'Table (2)'[ID] ), ALL ( 'Table (2)' ) )
)

vkkfmsft_2-1647839568258.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors