How to calculate intercompany ownership% calculation for a group companies?

Problem Statement:

I have a requirement where I have to calculate the indirect ownership% of the entities based on the input of direct ownership%

Example:

The direct ownership% of the entities

  • 'Entity 1' is the ultimate parent
  • 'Entity 2' is held by 'Entity 1' by 50%
  • 'Entity 3' is held by 'Entity 1' by 100%
  • 'Entity 4' is held by 'Entity 2' by 50% and 'Entity 3' by 50%
  • 'Entity 5' is held by 'Entity 3' by 100%

The outcome of the Indirect Ownership% should be

  • 'Entity 2' is held indirectly by 'Entity 1' by 50% through 'Entity 3'
  • 'Entity 4' is held indirectly by 'Entity A' by 100% through 3 possible ways
    • Entity 1 to Entity 2 to Entity 4 - 25%
    • Entity 1 to Entity 3 to Entity 4 - 50%
    • Entity 1 to Entity 3 to Entity 2 to Entity 4 - 25%
  • 'Entity 5' is held by 'Entity 1' indirectly by 100% through 'Entity 3'

Also, attaching sample hierarchy flow for your reference and share your thoughts/approaches to this requirement.

Regards,

Aswinraj Ramesh