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

Measure to count how many layer under each leader

Hi,

 

I have a summary table that I built in Excel that is counting how many employees under each management level/span of control/layer. The formula I used in excel was like below:

 

Formula = countif( count how many blank for each selected leader) 

The summary table as below:

 

LeadersManagement Chain 3Management Chain 4Management Chain 5Management Chain 6Management Chain 7Management Chain 8
Leader 1      
Leader 2      
Leader 3      
Leader 4      
Leader 5      
Leader 6      
Leader 7      
Leader 8      
Leader 9      
Leader 10      
Leader 11      
Leader 12      

 

The data structure is as below, which every chain has managers/employees and what the formula that I have in excel does, is count how many blanks under each management chain for the selected leaders from Management Chain : so if I want to count how many blanks for Leader 1 under Management Chain 3 

Management Chain 2Management Chain 3Management Chain 4Management Chain 5Management Chain 6Management Chain 7Management Chain 8
Leader 1      
Leader 2      
Leader 3      
Leader 4      
Leader 5      
Leader 6      
Leader 7      
Leader 8      
Leader 9      
Leader 10      
Leader 11      
Leader 12      

 

Is there any recommendation for a DAX measure that can be the same as excel formula?

 

Thank you!

2 REPLIES 2
Anonymous
Not applicable

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1649043194845.png

Here are the steps you can follow:

1. Select the marked column – Replace value

vyangliumsft_1-1649043194847.png

Replace null values with 0, where null values are displayed as null in power bi

vyangliumsft_2-1649043194849.png

2. Select the marked column – Transform – Unpivot Columns.

vyangliumsft_3-1649043194851.png

Result:

vyangliumsft_4-1649043194852.png

3. Create measure.

Measure =
COUNTX(FILTER(ALL('Table'),'Table'[Management Chain 2]=MAX('Table'[Management Chain 2])&&'Table'[Attribute]=MAX('Table'[Attribute])&&'Table'[Value]=0),[Value])

4. Result:

vyangliumsft_5-1649043194854.png

Please click here for the pbix file

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

Anonymous
Not applicable

Hi @Anonymous 

Thank you for your help. Just wanted to add more details before I go ahead and try your suggested solution/measure, the data I have are coming through SQL and I don't want to mess the data, if I want to go ahead with this solution, will this impact the data? 

Management Chains are fields within the Headcount Table that I usually get through SQL with specific fields. Please advise?

 

Thank you,

Zina

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!

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.