Yes, you are correct. The formula will work well for a single version in the issue. If the issue has several versions, you would like to check if the selected one is the “latest” from the ones listed for the issue.
This comparison is more tricky. Here is a suggested formula. I used a simple comparison only for the case there is one/none version on the issue and more complex and time-consuming for issues with several versions.
NonZero(SUM(
Filter(
Descendants([Issue].Currentmember, [Issue].[Issue]),
-- check if there are several versions ids => issue was in several versions
IIF([Issue].CurrentMember.GetString('Fix version IDs') MATCHES ".*,.*",
-- if there are several versions in issue, compare if the selected is the last one
Rank(
[Fix Version].CurrentMember,
[Fix Version].[Version].GetMembersByKeys([Issue].CurrentMember.Get('Fix version IDs'))
) = count([Fix Version].[Version].GetMembersByKeys([Issue].CurrentMember.Get('Fix version IDs'))
),
-- if there is none or 1 version in issue use simple comparison - if version on iuse is the same as selected
[Measures].[Issue fix versions] = [Fix Version].CurrentMember.Name
)
),
-- count valid issues only
[Measures].[Issues created]
))
Here I updated the formula by adding ordering of versions by version releae date:
NonZero(SUM(
Filter(
Descendants([Issue].Currentmember, [Issue].[Issue]),
-- check if there are several versions ids => issue was in several versions
IIF([Issue].CurrentMember.GetString('Fix version IDs') MATCHES ".*,.*",
-- if there are several versions in issue, compare if the selected is the last one
Rank(
[Fix Version].CurrentMember,
order([Fix Version].[Version].GetMembersByKeys([Issue].CurrentMember.Get('Fix version IDs')),
[Measures].[Version release date] , ASC)
) = count([Fix Version].[Version].GetMembersByKeys([Issue].CurrentMember.Get('Fix version IDs'))
),
-- if there is none or 1 version in issue use simple comparison - if the version on issue is the same as selected
[Measures].[Issue fix versions] = [Fix Version].CurrentMember.Name
)
),
-- count valid issues only
[Measures].[Issues created]
))