Schritt-für-Schritt
1.Initially ich durch die Vereinfachung durch das Löschen nicht wenige Klammern beginnen würde (hoffentlich!):
SELECT
NON EMPTY
[Measures].[Count of Assignee Reassignments] ON 0,
NON EMPTY
[Related Assignee History].[Modified By Id].[Modified By Id].ALLMEMBERS
*[Related Assignee History].[Parent Incident Id].[Parent Incident Id].ALLMEMBERS
*[Related Assignee History].[Start Date Time].[Start Date Time].ALLMEMBERS
FROM(
SELECT
FILTER(
[Related Assignee History].[Modified By Id].Children
,Left([Related Assignee History].[Modified By Id].CurrentMember.Name,1)="n"
) ON 0
FROM(
SELECT
[Incident].[Owner Group].&[Directors Group] ON 0
FROM(
SELECT
[Incident].[Reported Source].&[Self Service] ON 0
FROM(
SELECT
[Related Assignee History].[Start Date Time].ITEM(0) ON 0
FROM
(
SELECT [Date Reported].[Year].&[2016] ON 0
FROM [Incident]
)
)
)
)
);
2.Wenn Sie nur an [Date Reported].[Year].&[2016]
interessiert sind, dann lassen Sie uns aus den verrückten verschachtelten Subselects verschieben in eine WHERE
Klausel - kann in ähnlicher Weise der Vorfälle Mitglieder in diese WHERE
Klausel bewegen:
SELECT
NON EMPTY
[Measures].[Count of Assignee Reassignments] ON 0,
NON EMPTY
[Related Assignee History].[Modified By Id].[Modified By Id].ALLMEMBERS
*[Related Assignee History].[Parent Incident Id].[Parent Incident Id].ALLMEMBERS
*[Related Assignee History].[Start Date Time].[Start Date Time].ALLMEMBERS
FROM
(
SELECT
FILTER(
[Related Assignee History].[Modified By Id].Children
,Left([Related Assignee History].[Modified By Id].CurrentMember.Name,1)="n"
) ON 0
FROM
(
SELECT
[Related Assignee History].[Start Date Time].ITEM(0) ON 0
FROM [Incident]
)
)
WHERE
([Date Reported].[Year].&[2016]
,[Incident].[Owner Group].&[Directors Group]
,[Incident].[Reported Source].&[Self Service]);
3.Now läßt die Filter in eine WITH
Klausel bewegen und die Member_Caption
Eigenschaft verwenden, um Namen zu finden, die mit N beginnen, wie Nathaniel - wir werden dann die in der SELECT
Klausel benannte Menge verwenden:
WITH
SET [N_names] AS
FILTER(
[Related Assignee History].[Modified By Id].[Modified By Id].MEMBERS
,Left([Related Assignee History].[Modified By Id].CurrentMember.MEMBER_CAPTION,1) = 'N'
)
SELECT
NON EMPTY
[Measures].[Count of Assignee Reassignments] ON 0,
NON EMPTY
[N_names]
*[Related Assignee History].[Parent Incident Id].[Parent Incident Id].ALLMEMBERS
*[Related Assignee History].[Start Date Time].[Start Date Time].ALLMEMBERS
FROM
(
SELECT
[Related Assignee History].[Start Date Time].ITEM(0) ON 0
FROM [Incident]
)
WHERE
([Date Reported].[Year].&[2016]
,[Incident].[Owner Group].&[Directors Group]
,[Incident].[Reported Source].&[Self Service]);
4.I'm zu raten, dass dies [Related Assignee History].[Start Date Time].ITEM(0)
Ihr Versuch, das min Datum für jede Person zu finden, so werde ich, dass für die Zeit Befinden löschen:
WITH
SET [N_names] AS
FILTER(
[Related Assignee History].[Modified By Id].[Modified By Id].MEMBERS
,Left([Related Assignee History].[Modified By Id].CurrentMember.MEMBER_CAPTION,1) = 'N'
)
SELECT
NON EMPTY
[Measures].[Count of Assignee Reassignments] ON 0,
NON EMPTY
[N_names]
*[Related Assignee History].[Parent Incident Id].[Parent Incident Id].ALLMEMBERS
*[Related Assignee History].[Start Date Time].[Start Date Time].ALLMEMBERS
FROM [Incident]
WHERE
([Date Reported].[Year].&[2016]
,[Incident].[Owner Group].&[Directors Group]
,[Incident].[Reported Source].&[Self Service]);
5.Now wird es etwas komplizierter:
WITH
SET [N_names] AS
FILTER(
[Related Assignee History].[Modified By Id].[Modified By Id].MEMBERS
,Left([Related Assignee History].[Modified By Id].CurrentMember.MEMBER_CAPTION,1) = 'N'
)
SET [N_names_plusDates] AS
GENERATE(
[N_names] AS N
, N.CURRENTMEMBER
* TAIL(
NONEMPTY(
[Related Assignee History].[Start Date Time].[Start Date Time].MEMBERS
,N.CURRENTMEMBER
)
)
)
SELECT
NON EMPTY
[Measures].[Count of Assignee Reassignments] ON 0,
NON EMPTY
[N_names_plusDates]
*[Related Assignee History].[Parent Incident Id].[Parent Incident Id].ALLMEMBERS
FROM [Incident]
WHERE
([Date Reported].[Year].&[2016]
,[Incident].[Owner Group].&[Directors Group]
,[Incident].[Reported Source].&[Self Service]);