...
In order to include the parent id in an export, you will need to ensure it is selected when you create a case export. More detail on case exports can be found hereat https://dimagi.atlassian.net/wiki/x/vCzKfw.
Overall Settings
Make sure to set your file type to Excel.
Parent Case Section
Choose Parent Cases:
...
You must then include at least row.number and case_id:
...
Matching the Parent Case in an Export
...
The two tabs (and two cases) are linked together by the variable row.number. If you want to add the parent id to the first tab (the one with the case data), see the Using Lookups (Vlookup and Hlookup) page about how to use the VLOOKUP feature in Excel at https://dimagi.atlassian.net/wiki/x/PSXKfw.
If you want to include more detail from the parent case, you will need to separately export the parent case and use the case_id to link the data together.
Multiple Levels
If you have a "grandparent" case you will need to link the levels one at a time. For example, imagine a case structure where you have household - mother - child. In order to link the child to the household you need to first link the child to the mother, and then the mother to the household.
Application Design
You can make this type of analysis much easier by thinking about where to save key variables in your application design. For example, if your parent case type has some sort of unique ID or name, you can save that name to the child case. You can also save other parent properties to the child case.