I'm trying to create a measure in SSAS Cube with MDX, to understand my point it is more easier explain based in source ( SQL ).
I have a table that it is loaded in cube. This table have steps sequence like a transaction table ( not all steps are mandatory ):

In the cube I have a measure to sum the StepTimeinDays and other measure to calculate the percent of StepTimeinDays:
([Measures].[StepTimeinDays],[Product].[Step].CurrentMember)/([Measures].[StepTimeinDays],[Product].[Step].[All])
The measure to sum StepTimeinDays are ok, returning the expected result in cube by step:

I need to create a measure that return StepTimeinDays for all Steps only for process where step have the step "2_Saw" in the cube.
To clarify, in SQL is the same to return with "filter" in the transaction table only the data with step "2_Saw" in the all product process for each product like this:

And will return the result ( this is that I need to return in the measure in Cube ):

I could return the result expected only in SQL with the query:
select Step
, sum(StepTimeinDays) as SumofStepTimeinDays
from dbo.build_process t1
where exists (
select 1
from dbo.build_process t2
where t1.ProductCode = t2.ProductCode and t1.OperatorName = t2.OperatorName
and t2.Step = '2_Saw'
)
group by Step
order by Step asc;
Does anybody knows how to retun the same as this query in the SSAS Cube Measure?


