This is a bit of data joining fun! Your Units measure is on the child table looking up, so it’s value will only ever be 1 because each Child row only has one parent. However, the data “explodes” because in the context of the measure, it is being repeated for every row in the Child table every time you ask for it to be calculated. Note how the sequence of the numbers in the second ID column repeat over and over.
Another question is what exact count you are trying to get per line item (or per parent?). I have 3 options for you.
Step 1 to fix this is to create a measure table. Use “Enter Table” to create a new manual table, name it something obvious like “Measures”, then save it (with no data entered).
Step 2 is to create measures for the counts you would like under that new Measures table. This depends on context at the time the measure is calculated. I created 2 measures to satisfy the 3 options I mentioned, using your attached PBIX (I have September 2022 Desktop): CountRows_Child and Count_ParentsChildren.
The first measure, CountRows_Child, is shown below along with the example tables for the new measures. This measure will count all the rows in the Child table for the given context. The first table on the left is the one you included. I removed Units and added CountRows_Child. Because the context is every line item under every parent, the count is always 1.
In the middle table, I removed the Child columns which made the context each row in the Parent table. You can see that the same exact measure now returns the total number of Child records for each Parent ID.
The second measure, Count_ParentsChildren, assumes you want to know for every Child record how many total children the Parent ID has. This requires changing the context for each calculation of the measure to extract the Parent ID value, then calculate the count of Child records for that ID regardless of the current context.
In the table on the right, you can see that for each Child line item displayed, the correct count of the Parent’s children is displayed.
My changes are in the attached PBIX, based on your original.
Exploding Table.pbix (21.9 KB)