Hello! I have the following formula that I’d like to optimize. I tried to do it with the help of AI, but the result wasn’t good. The formula currently returns the information well, but it’s very slow an reach 60 secods.
Report Description:
The objective of the report is to show all “Feature” type issues resolved in the current Q but also those resolved in the previous 3 Qs.
Formula to Optimize
-- Optimized formula that returns the same results
CASE WHEN
-- Check if there are any issues resolved with status "Finalizado"
-- in the quarter that is 2 quarters before current date
(
[Measures].[Issues resolved],
[Status].[Finalizado],
[Time].[Quarter].CurrentDateMember.Lag(2)
) > 0
THEN
-- Calculate the sum directly with all conditions in one tuple
Sum(
Filter(
DescendantsSet([Issue].CurrentHierarchyMember, [Issue].[Issue]),
-- Direct filter condition without using IIF
(
[Measures].[Time to Market Delivery],
[Status].[Finalizado],
[Time].[Quarter].CurrentDateMember.Lag(2)
) > 0.5
AND
(
[Measures].[Time to Market Delivery],
[Status].[Finalizado],
[Time].[Quarter].CurrentDateMember.Lag(2)
) < 12
),
(
[Measures].[Issues resolved],
[Status].[Finalizado],
[Time].[Quarter].CurrentDateMember.Lag(2)
)
)
ELSE
-- Return 0 if there are no issues resolved in the context
0
END
Formula Time to Market Delivery. Within the main formula, use conditions on a measure called Time to Market Delivery
CoalesceEmpty(
CASE WHEN [Measures].[Issues resolved] > 0 THEN
Avg(
Filter(
DescendantsSet([Issue].CurrentMember, [Issue].[Issue]),
DateInPeriod(
[Measures].[Issue resolution date],
[Time].CurrentHierarchyMember
)
AND
[Measures].[Issue status] = "Finalizado"
-- AND [Measures].[Issue ¿Mide?] = '(none)'
),
DateDiffDays(
[Measures].[Fecha de Transición a Pendiente],
[Measures].[Issue resolution date]
)
)*24/720
END
,0)```
Thanks!