# Calculate multiple custom fields based on conditions

I have several stages custom Fields with drop down list.
I want to count maturity based on another custom field called Project Type : Type 1, Type 2
So basically to count only issues where (Project Type = Type 1 and count of completed stages>=3 , OR Project Type = Type 2 and count of completed stages >=5).

I created the count measure for the completed stages custom fields in each issue and thought to use it in the calculation with the project Type but it did not work for me.

Wonder if you can help me with the following.

It seems both custom fields Project type and Stages could be imported into eazyBI as dimensions.

You can create a calculated measure where you iterate through all Project types and apply a bit different logic for each Project type:

``````NonZero(SUM(
Descendants([Project type].CurrentMember, [Project type].[Project type]),
-- set the logic per each project type
CASE [Project type].CurrentMember.Name
When "Type 1" Then
([Measures].[Issues created], [Completed stages].[more than 3])
When "Type 2" Then
([Measures].[Issues created], [Completed stages].[more than 5])
END
))
``````

You might want to have a calculated member in the dimension of the Completed stage to specify completed stages more than 3 and completed stages more than 5.

For example, if the customfield completed stages have values 1,3,5,8, then more than 5 would be 5 and 8. You can define a new calculated member More than 5 in dimension Completed stages:

``````Aggregate({
[Completed stages].[5],
[Completed stages].[8]
})
``````

If there are several custom fields, the solution on how to access particular stages could be different.

Daina / support@eazybi.com

Thx, I actually created the accumulated as I have 8 stages with 8 different custom fields
(
[Measures].[Issues created],
[Automated deployment].[Completed]
)
+
(
[Measures].[Issues created],
[Automated SW distribution].[Completed]
)

Ideally I am looking to look at this measure and count only the ones which will be with combination of the Type and the stage measure as describe before.
So if type 1 and count greater or equal to 3 - count it, if Type 2 and stage count greater or equal to 5 count it as well.