Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Summary table based on activity logs

Hi everyone, I'm hoping someone can assist with a query. I have two tables with lots of data - 1 million+ lines in each one.

Table 1

Each line in this table shows a ticket ID (RefNum) and the resolver group that is currently assigned to that ticket (AssignedGroup). Each line is in no particular order. Example below:

RefNumAssignedGroup
1054675Networks
1054976Application Support
1251685Global Delivery
1290806Service Desk
1294302Global Delivery
1296581Service Desk

 

Table 2

Each line in this table shows a ticket ID (RefNum), activities that have occurred within each ticket (ActivityType), and a datestamp for that activity (DateActivityCreated). There may be multiple lines for each RefNum, and each line is in no particular order. Table 2 has a relationship to Table 1 via the 'RefNum' field. Example below:

RefNumActivityTypeTransferred FromTransferred ToDateActivityCreated
1054675Reopened  19/02/2019 9:58
1054675Resolved  19/02/2019 9:59
1054675Event Logged  30/04/2019 8:44
1054675Group TransferredService DeskNetworks11/07/2019 12:12
1054976Event Logged  19/02/2019 9:59
1054976Group TransferredService DeskApplication Support19/02/2019 9:59
1251685Event Logged  11/07/2019 12:11
1290806Reopened  7/02/2019 14:05
1290806Group TransferredApplication SupportGlobal Delivery7/02/2019 14:05
1290806Group TransferredGlobal DeliveryDesktop7/02/2019 14:06
1290806Event Logged  7/02/2019 14:06
1290806Status Changed  7/02/2019 14:06
1290806Status Changed  7/02/2019 14:07
1290806Group TransferredDesktopService Desk7/02/2019 14:09
1290806Resolved  7/02/2019 14:09
1294302Event Logged  15/03/2019 14:40
1296581Field Updated  11/03/2019 13:57
1296581Field Updated  11/03/2019 13:57
1296581Event Logged  11/03/2019 13:57

 

Requirement

I'd like to be able to create a summary table that shows me a unique list of 'RefNum' numbers, showing where tickets are assigned at the point of SLA failure. SLA failure is signified by 'Event Logged' in Table 2.

Examples:

Here's what I would expect to see:

RefNumGroup Expired
1054675Service Desk
1054976Service Desk
1251685Global Delivery
1290806Desktop
1294302Global Delivery
1296581Service Desk


So for example, RefNum 1054675 is showing 'Networks' as the current AssignedGroup in the summary table because that is who the RefNum was last 'Transferred To' in Table 2. But the first 'Event Logged' for RefNum 1054675 occurrs when the ticket is still with the 'Service Desk' and before 1054675 is transferred to Networks, so the summary table should show 'Service Desk' as the 'Group Expired'.

In the case of 1296581, no Group Transfer has taken place. So the 'Group Expired' column in the summary table should be 'Service Desk'.

In the case of 1290806, the 'Event Logged' occurred after the last 'Group Transferred' activity to 'Desktop', so the 'Group Expired' column in the summary table should be 'Desktop'.

Note: 'Last', 'first', 'after' etc. are all determined by the 'DateActivityCreated' column.



Any help would be appreciated!

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

You can try to add a new calculated table to get your expected result.

Table 2 =
ADDCOLUMNS (
    DISTINCT ( 'RefNum'[RefNum] ),
    "Group Expired",
    VAR t =
        FILTER (
            'RefNum',
            'RefNum'[RefNum] = EARLIER ( [RefNum] )
                && TRIM ( 'RefNum'[Transferred From] ) <> ""
                && TRIM ( 'RefNum'[Transferred To] ) <> ""
        )
    RETURN
        IF (
            COUNTROWS ( t ) = 0,
            MAXX (
                FILTER ( 'Table1', 'Table1'[RefNum] = EARLIER ( [RefNum] ) ),
                [AssignedGroup]
            ),
            MAXX (
                FILTER (
                    t,
                    'RefNum'[Transferred To]
                        = MAXX (
                            FILTER ( 'Table1', 'Table1'[RefNum] = EARLIER ( [RefNum] ) ),
                            [AssignedGroup]
                        )
                ),
                [Transferred From]
            )
        )
)

Best Regards,
Jack Chen

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

You can try to add a new calculated table to get your expected result.

Table 2 =
ADDCOLUMNS (
    DISTINCT ( 'RefNum'[RefNum] ),
    "Group Expired",
    VAR t =
        FILTER (
            'RefNum',
            'RefNum'[RefNum] = EARLIER ( [RefNum] )
                && TRIM ( 'RefNum'[Transferred From] ) <> ""
                && TRIM ( 'RefNum'[Transferred To] ) <> ""
        )
    RETURN
        IF (
            COUNTROWS ( t ) = 0,
            MAXX (
                FILTER ( 'Table1', 'Table1'[RefNum] = EARLIER ( [RefNum] ) ),
                [AssignedGroup]
            ),
            MAXX (
                FILTER (
                    t,
                    'RefNum'[Transferred To]
                        = MAXX (
                            FILTER ( 'Table1', 'Table1'[RefNum] = EARLIER ( [RefNum] ) ),
                            [AssignedGroup]
                        )
                ),
                [Transferred From]
            )
        )
)

Best Regards,
Jack Chen

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

Hi @Anonymous  ,

Please clarify the following:

 

In the case where ActivityType Event Logged and Group Transferred have the exact same value for DateActivityCreated, how can you differentiate which activity was done last? 

For example below, 

1290806Group TransferredGlobal DeliveryDesktop7/02/2019 14:06
1290806Event Logged  7/02/2019 14:06


Any chance you can format your DateActivityCreated column to show the seconds as well?

Cheers,
Robin

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.