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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
TimKroemer
Frequent Visitor

Calculate % of a Subset with Page Level Filters

Hi All

 

I am trying to calculate % of a subset of data but respecting active Page Level Filters. Put differently, I have staff that are classified by category (e.g. A - Z) and function (e.g. Construction). 

 

I am trying to calculate the headcount in each category as a % of headcount in a particular function (e.g. Category A is x% of Construction headcount).

 

I have tried creating a new column using the following formula:

 

% of Construction = CALCULATE(COUNTROWS(Payroll),FILTER(Payroll,Payroll[Designation]=EARLIER(Payroll[Designation])))/
CALCULATE(COUNTROWS(Payroll),FILTER(Payroll,Payroll[Tier]="Construction"))

 

but this consistently calculates percentages on a total basis and does not consider active filters (for example, I might select a project filter to view only certain staff that have been allocated to the project - I then need Category A is x% of Construction headcount within Project y).

 

I have also tried using a measure calculation using the following formula (amongst others):

 

(M) % of Construction = COUNT(Payroll[Emp Number])/COUNTAX(ALLSELECTED(Payroll),Payroll[Tier]="Construction")

 

Any help would be greatly appreciated!

This only looks at the information shown in the table so always gives me 100%.

2 REPLIES 2
Anonymous
Not applicable

Hi @TimKroemer,

 

Slicer works on visual level, you can't use it to affect the result of calculate column. These formula of calculated column has been pretreatmented in dax formula and it can't get the chosen item from slicer.

 

In my opinion, I'd like to suggest you use measure and allselected filter to calculate the result based on the chosen of slicer.

 

In addition, you can also try to use power query with parameterized, it will affect the source table dynamically.

 

Refereence link:

Deep Dive into Query Parameters and Power BI Templates

 

Regards,

Xiaoxin Sheng

Xiaoxin

 

Thank you very much for taking the time to respond - I will try the approach you suggested and then hopefully conclude this thread with a workable solution based on your advice.

 

Gratefully,

 

Tim

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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