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
JoeCrozier
Helper II
Helper II

Make Pie chart show percent rows of total rows

I have data that looks like this:

JoeCrozier_0-1683743490813.png

Its a row for every user in my clinical trials system, what their contact id is, and what department they're in.

 

I also have other data that is a row for every protocol we're tracking, one column of which is what department that protocol is in. 

 

I'd like to create a visual like this (pictured, though not working perfectly yet), where I select a study, it shows what department that study is in, and then a pie chart that would show:  "of the 821 total users, 328 of them are in that department"

JoeCrozier_1-1683743669526.png

 

It ALMOST works.  All the data is linked to each other, and if I select a different dept the pie chart will change to reflect the users in that department, the problem is it doesn't keep the 'out of 821' as a total.  The entire pie chart just becomes however many rows are in that department. 

 

How do I get the pie chart to show percent of total rows?

 

 

 

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

Hi  @JoeCrozier ,

I created some data:

vyangliumsft_0-1683858797769.png

 

Here are the steps you can follow:

1. Create measure.

Measure =
var _select=SELECTCOLUMNS('Table',"1",[Department])
var _all=COUNTX(ALL('Table'),[User])
var _group=COUNTX(FILTER(ALL('Table'),'Table'[Department] in _select &&'Table'[Department]=MAX('Table'[Department])),[User])
return
DIVIDE(
    _group,_all)

2. Result:

vyangliumsft_1-1683858797772.png

 

Best Regards,

Liu Yang

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-yangliu-msft
Community Support
Community Support

Hi  @JoeCrozier ,

I created some data:

vyangliumsft_0-1683858797769.png

 

Here are the steps you can follow:

1. Create measure.

Measure =
var _select=SELECTCOLUMNS('Table',"1",[Department])
var _all=COUNTX(ALL('Table'),[User])
var _group=COUNTX(FILTER(ALL('Table'),'Table'[Department] in _select &&'Table'[Department]=MAX('Table'[Department])),[User])
return
DIVIDE(
    _group,_all)

2. Result:

vyangliumsft_1-1683858797772.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.