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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
TBensen
Helper I
Helper I

Create a Counted Summary Table

Hello,

 

I'm hoping someone can give me a hand with figuring out how to create a summary table of counts on a specific column value from 2 different tables.  Here is what I have going on...

 

Incident Table: The Incident table contains all of the incidents that are associated to an Employee ID.  This table also contains a Seniority year that is calculated based off of the Incident Date minus the Date of Hire, which gives us a Seniority Year at the time of the incident. 

 

Employee IDRecord Number

Seniority Year

emp_1123

2

emp_1234

2

emp_2345

4

emp_3456

7

emp_4567

5

 

From this I can get a count of Incidents by Seniority Year:

Seniority Counts of Records.png

 

Employee Table: The employee table contains all of the employees throughout the organization.  This table also contains the Employee ID and Years of Service that is calculated based off of Today minus Date of Hire.

 

Employee IDYears of Service
emp_13
emp_27
emp_310
emp_47

 

Using this data set, I can get a count of the organization population based off of the Seniority Years.

Seniority Counts of Population.png
Now is where the tricky part begins...or if it even makes sense to do this.

I want to take the Count of Incidents by Seniority and divide it by the Counts of Employees in a Seniority Year bucket to give us a rate of incidents by Seniority Year.  In the picture examples, [Seniority Years 0] 512 / [Years of Serivce 0] 1749 = .293.

I've tried merging tables and creating calculated columns, but for some reason I just can't get it to work out.

 

Thank You,
Trevor Bensen

 

1 ACCEPTED SOLUTION
DataZoe
Microsoft Employee
Microsoft Employee

Hi @TBensen ,

 

You can do this by introducing a "Seniority" table with each of the numbers for each row. Then removing any other relationships between the Employee table and Incident table, join them both to the Seniority table on the number of years columns.  

DataZoe_0-1612230811189.png

 

You can then create a measure for Incidents, People, and Rate of Incidents.

Incidents = countrows(Incident)+0
People = COUNTROWS(Employee)+0
Rate of Incidents = DIVIDE([Incidents],[People])
 
Then you create a table with the Seniority table's Seniority Year and the measures you want.
DataZoe_3-1612231013810.png

 

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

View solution in original post

2 REPLIES 2
DataZoe
Microsoft Employee
Microsoft Employee

Hi @TBensen ,

 

You can do this by introducing a "Seniority" table with each of the numbers for each row. Then removing any other relationships between the Employee table and Incident table, join them both to the Seniority table on the number of years columns.  

DataZoe_0-1612230811189.png

 

You can then create a measure for Incidents, People, and Rate of Incidents.

Incidents = countrows(Incident)+0
People = COUNTROWS(Employee)+0
Rate of Incidents = DIVIDE([Incidents],[People])
 
Then you create a table with the Seniority table's Seniority Year and the measures you want.
DataZoe_3-1612231013810.png

 

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

Hello,

 

This worked out great!  Thank you for your help.  I was definitely over-complicating what I was trying to accomplish.

 

Thanks Again,
Trevor Bensen

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.