Hi @mucenieks,
The bottleneck of this approach is the necessity of iterating through all issues in the data cube to identify the oldest, highest priority, latest, etc.
While iterating through the issues is still required, it might be optimized by reducing the dataset and rearranging conditional clauses into steps.
If you are only interested in issue current values - you might create custom hierarchies based on Issue Type or Issue Priority within the Issue dimension.
If you have multiple projects within the data cube, issues are distributed among projects, and only a fraction of issues is actually in scope for the report - you might pre-filter the projects and only include issues from these projects in the scope for inspection.
The existing code for finding the oldest bug that has not yet been done is quite good.
I would change the direct reference to the property of the first item in the set .item(0).get(“”) into a different construction to handle the potential error in case of an empty set.
I would also rearrange the conditions so that issues are first filtered by their properties and measure value is only requested for a reduced dataset.
The updated expression might then be as follows.
Generate(
Head(
Order(
Filter(
DescendantsSet(
[Issue].CurrentMember,
[Issue].[Issue]),
--filter conditions on issue properties
[Measures].[Issue type] = "Bug"
AND
NOT [Measures].[Issue status] = "Done"
),
--value for ordering
--only check for relevant issues
CASE WHEN
[Measures].[Issues created]>0
THEN
DateToTimestamp([Issue].CurrentMember.Get('Created at'))
END,
--order direction
BASC),
--number of items from the beginning
1),
--string value to be returned for Generate
CAST([Issue].CurrentMember.Key as string),
--split by comma - for compatitbility reasons
",")
Different optimization techniques could be used, depending on the size of the dataset, report context, and distribution of issues across different categories.
Still, identifying the individual issue requires iteration through the issue dimension, and that takes time.
Regards,
Oskars/ support@eazyBI.com