June 29, 2022
I have a table containing incident-level data for August 2022. Each incident can have multiple youth involved. For example, if incident 12345 had 3 youth involved, 3 rows would appear for incident 12345. Each unique youth can be involved in multiple incidents, so I summarized the values for my Youth ID variable (ID_Youth) by Distinct Count to get the number of unique youth involved in one or more incident in August 2022. This worked great for the total and even when I broke that total out by Sex and Race; however, it is not working if I break the total out by Age or other variables that might change over time. As shown in the fake table below, summing across the age categories equals 23, rather than 18.
Row Labels Distinct Count of ID_Youth
12 and under 2
13 2
14 5
15 5
16 5
17 2
18 and over 2
Grand Total 18
This is because youth can be involved in multiple incidents and Age might change from one incident to another. Unfortunately, this will confuse my users. For variables like Age, I would like to classify each youth according to their Age (or other characteristic) as of the first incident they were involved in during the month. For example, if Jonny was involved in 3 incidents in August, one on 8/10, one on 8/12, and one on 8/25, I'd like to use his age from 8/10. Is there any way to make this happen? I thought I could fix this issue by adding a variable to my table coded as 1 for the first incident each unique youth was involved in during the month; however, this leads to issues once slicers are applied. For example, if I sliced the data below to only look at Assaults, I would lose this youth even though he had two assaults, because my proposed filter for First_Incident would be 0 for both assault records. For this example, I would love to use the data from 8/22/22, which is the earliest of the records left after the slicer is applied.
Any help would be much appreciated. I would hate to have to add notes to all the charts saying "Figures may add to more than the total because ...".
I find our users get very confused if things don't add. Thank you!!
ID_Incident Incident_DT ID_Youth Age Incident_Type First_Incident
12345 8/10/22 2244 15 Contraband 1
12345 8/10/22 2244 15 AWOL 1
12345 8/10/22 2244 15 Restraint 1
99888 8/22/22 2244 15 Assault 0
99888 8/22/22 2244 15 Hospital/Medical 0
99888 8/22/22 2244 15 Restraint 0
99888 8/22/22 2244 15 Other 0
10999 8/28/22 2244 16 Assault 0
10999 8/28/22 2244 16 Hospital/Medical 0
July 16, 2010
Hi Jennifer,
I think you need to add another column to your Youth Age table that converts their age based on the first incident of the month. You could do this in Power Query.
I hope that points you in the right direction. If you get stuck, please come back with a small sample Excel file that illustrates the issue so we can help you further.
Mynda
1 Guest(s)