Test last execution status

Hi,
I have a project with issue types Customer requirement , EPIC and Test

The links are as follows Customer requirement → EPIC → Test

Customer requirement are linked to epic with implemented by
epic is linked to the Test with tested by

I use the XRAY add-on to run tests

I want to calculate the execution status of the last run of all the tests related to customer requirement by the links I described above (regardless of a particular test plan or test execution)

The report should look like this:

Row : customer requirement

Column: execution status of the last run of all the tests

i write this

Generate (
– get a list issues
Generate(
Filter(
[Issue]. [Issue] .GetMembersByKeys (
[Issue] .CurrentHierarchyMember.get (‘implemented by’)
),

[Issue].CurrentMember.Parent.Key matches ‘CCNPMS.*’
),
[Issue].[Issue].GetMembersByKeys(
[issue].CurrentMember.get(‘tested by’)
)
)

,
– show by key
cast ([Issue].CurrentHierarchyMember.Get(‘Xray Last execution status’) as string),
‘,’)

but this line:cast ([Issue].CurrentHierarchyMember.Get(‘Xray Last execution status’) as string)
does not give correct results
Can anyone help me?

Thanks
shoshi