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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
Anonymous
Not applicable

Complex formula to provide counts and accurate percentages

Hi All- 

 

I'm working on the intersection between two tables.

One table is a list of employees. There is one line per employee, there is a region column, and a status column (active or inactive). 

The other table is a list of certifications. There is one line per certification, there is a platform column (i.e. scrum, c+), there is a name column (matching names on the other table), and a status column (active or inactive). 

I'm trying to create essentially a pivot table. The columns across the top are the platforms, and each platform has a count and a percentage (percentage of employees in that region, not total). The rows are the regions. This should only reflect active employees by country (using the first table as a reference). 

This is the formula I'm using right now, but it's providing inaccurate percentages and I can't figure out why: 

Percentage Certifications New =

// get distinct count of employees on certifications list witn only active employees

var individuals = DISTINCTCOUNT('Certifications Active Only'[Name])

// get count of active employees on employee list

var total = COUNTAX('GlobalTeam (2)',[Status]="Active")

// get count of employees by country !!ONLY one of the two options!!

// OPTION 1 var countryTotal = COUNT('GlobalTeam (2)'[Country])
// OPTION 2 var countryTotal = COUNT('Certifications Active Only'[Country])

// get percentage of certified employees in the country

var percentage = ROUND(((individuals/countryTotal)*100),0)

// return all values for auditing purposes. Once complete only percentage will be returned

return "percent"&percentage&"!total"&total&"!ind"&individuals&"!country"&countryTotal

 

Option 1 returns the same countryTotal for every single row, including the total row. This is not correct. Option 2 returns a count of every certification line relevant to the platform, where multiple lines can reflect a single individual. The 61 in the screenshot below is more rows than we have employees with BP certifications. 

 

Here's a small example screenshot of the table reflecting option 2, for help explaining it. table.PNG

 

I can't do a distinct count on the names in the certifications list, because then numberator and denominator will be the result of the same function so everything will be 100%. Please help!!

 

Thank you!

 

1 REPLY 1
lbendlin
Super User
Super User

You are describing two "dimension" tables (employees and certifications) but it seems you leave out the "fact" table (employee certifications) ?

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.