<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Tickets sent to and from a specific team in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tickets-sent-to-and-from-a-specific-team/m-p/2881036#M93258</link>
    <description>&lt;P&gt;File attached. Be prepared to see some serious M code... You'll have to adjust things here and there because I did not know how to handle the starts of ticket flows and their ends. Should they be treated as the Sent/Received actions or should they belong to their own special categories? You have not specified this... so I've assumed the event "Received" also applies to the beginning of a flow. Similarly for the "Sent" event.&lt;/P&gt;</description>
    <pubDate>Wed, 02 Nov 2022 18:16:51 GMT</pubDate>
    <dc:creator>daXtreme</dc:creator>
    <dc:date>2022-11-02T18:16:51Z</dc:date>
    <item>
      <title>Tickets sent to and from a specific team</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tickets-sent-to-and-from-a-specific-team/m-p/2876401#M92955</link>
      <description>&lt;P&gt;Hi &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;I am working through a probem where we have tickets being sent between departments, sometime multiple times a day. My goal is to create a chart that shows the number of tickets sent to/from a team based on a team filter. So the chart would change based on what team is selected in the filter. I have the date table set, but I am struggling with how to count the number of times a ticket sent to/from a given team ID.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The fact table consists of time stamps for every stage of the ticket.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample data:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Ticket ID&lt;/TD&gt;&lt;TD&gt;Team ID&lt;/TD&gt;&lt;TD&gt;Start Date/Time&lt;/TD&gt;&lt;TD&gt;End/Date Time&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;111&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;01/01/2022 10.04.21&lt;/TD&gt;&lt;TD&gt;01/02/2022 13.34.10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;111&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;01/02/2022 13.34.10&lt;/TD&gt;&lt;TD&gt;01/05/2022 12.56.03&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;111&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;01/05/2022 12.56.03&lt;/TD&gt;&lt;TD&gt;01/07/2022 10.30.45&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;222&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;01/04/2022 09.43.10&lt;/TD&gt;&lt;TD&gt;01/04/2022 10.15.15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;222&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;01/04/2022 10.15.15&lt;/TD&gt;&lt;TD&gt;01/15/2022 11.12.45&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;222&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;01/15/2022 11.12.45&lt;/TD&gt;&lt;TD&gt;02/01/2022 14.35.37&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;222&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;02/01/2022 14.35.37&lt;/TD&gt;&lt;TD&gt;02/15/2022 11.21.07&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ultimately I would like to show that Team 1 in January has sent two tickets and received one. For Team 2 the result would be that they've sent two tickets and received two.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I'm missing some important info of course let me know and I'll provide.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking forward to any suggestions!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;J&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 07:22:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tickets-sent-to-and-from-a-specific-team/m-p/2876401#M92955</guid>
      <dc:creator>jimminy</dc:creator>
      <dc:date>2022-11-01T07:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: Tickets sent to and from a specific team</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tickets-sent-to-and-from-a-specific-team/m-p/2876487#M92960</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="380076" data-lia-user-login="jimminy" class="lia-mention lia-mention-user"&gt;jimminy&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where is the information about who sent and who received the same ticket? Maybe it'd be useful to add this information as a column with statuses of (Ticket Sent, Ticket Received) to the table? It would make life (and coding) definitely easier.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 07:58:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tickets-sent-to-and-from-a-specific-team/m-p/2876487#M92960</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-11-01T07:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Tickets sent to and from a specific team</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tickets-sent-to-and-from-a-specific-team/m-p/2876510#M92961</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="349489" data-lia-user-login="daXtreme" class="lia-mention lia-mention-user"&gt;daXtreme&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunetly the data set does not include this information outright, but it comes in the form of sequence like depicted above. So we can assume that the "flow" of the ticket is such. If the team changes from 1 to 2 for ticket id 111, then the ticket is sent from 1 to 2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I should note I've also included a "Group Rank" column for each ticket in my file, so that rank 1 indicates the first step and so on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does this help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;J&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 08:04:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tickets-sent-to-and-from-a-specific-team/m-p/2876510#M92961</guid>
      <dc:creator>jimminy</dc:creator>
      <dc:date>2022-11-01T08:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: Tickets sent to and from a specific team</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tickets-sent-to-and-from-a-specific-team/m-p/2876726#M92968</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="380076" data-lia-user-login="jimminy" class="lia-mention lia-mention-user"&gt;jimminy&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I don't know all the particularities of your file, model, expected visuals, etc., but one of the ways is to create calculated columns to define if the ticket was sent/received and measures to count these events.&lt;/P&gt;&lt;P&gt;1. You need to have a proper Date table. So I suppose you do.&lt;/P&gt;&lt;P&gt;2. You've mentioned a&amp;nbsp;&lt;SPAN&gt;"Group Rank" column, so I've created one as well:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Step = 
VAR current_ticketID = 'Table'[Ticket ID]
VAR tickets =
    FILTER ( 'Table', 'Table'[Ticket ID] = current_ticketID )
RETURN
    RANKX ( tickets, [Start Date/Time],, ASC )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. Send/Receive calculated columns:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Send = 
VAR current_date = 'Table'[Start Date/Time]
VAR current_ticketID = 'Table'[Ticket ID]
VAR next_date =
    CALCULATE (
        MIN ( 'Table'[Start Date/Time] ),
        FILTER (
            'Table',
            'Table'[Start Date/Time] &amp;gt; current_date &amp;amp;&amp;amp; 'Table'[Ticket ID] = current_ticketID
        )
    )
VAR next_teamID =
    CALCULATE (
        MIN ( 'Table'[Team ID] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Start Date/Time] = next_date )
    )
RETURN
    SWITCH (
        TRUE (),
        'Table'[Step] = 1, 'Table'[Team ID],
        'Table'[End/Date Time] &amp;lt;&amp;gt; BLANK ()
            &amp;amp;&amp;amp; next_teamID &amp;lt;&amp;gt; BLANK ()
            &amp;amp;&amp;amp; next_teamID &amp;lt;&amp;gt; 'Table'[Team ID], 'Table'[Team ID],
        BLANK ()
    )&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Receive = 
VAR current_date = 'Table'[Start Date/Time]
VAR current_ticketID = 'Table'[Ticket ID]
VAR previous_date =
    CALCULATE (
        MAX ( 'Table'[Start Date/Time] ),
        FILTER (
            'Table',
            'Table'[Start Date/Time] &amp;lt; current_date &amp;amp;&amp;amp; 'Table'[Ticket ID] = current_ticketID
        )
    )
VAR previous_teamID =
    CALCULATE (
        MAX ( 'Table'[Team ID] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Start Date/Time] = previous_date )
    )
RETURN
    IF (
        'Table'[Step] &amp;lt;&amp;gt; 1 &amp;amp;&amp;amp; 'Table'[Team ID] &amp;lt;&amp;gt; previous_teamID,
        'Table'[Team ID]
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;They indicated a team id if it has sent and/or received a ticket. Please, take into account that I used a Start date column only for the events occurence. I've also used this column to create another one (Date only) and connect it to the Date table.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;4. Create measures to count events:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sent = COUNT('Table'[Send])&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Received = COUNT('Table'[Receive])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Result:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 09:17:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tickets-sent-to-and-from-a-specific-team/m-p/2876726#M92968</guid>
      <dc:creator>ERD</dc:creator>
      <dc:date>2022-11-01T09:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: Tickets sent to and from a specific team</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tickets-sent-to-and-from-a-specific-team/m-p/2880345#M93204</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="380076" data-lia-user-login="jimminy" class="lia-mention lia-mention-user"&gt;jimminy&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The fact that the data does not contain this info in a clear form does not mean you can't add this via Power Query! You certainly can. Enriching the data with such info would be tremendously beneficial.&lt;/P&gt;
&lt;P&gt;If I get a chance, I'll try to do it in PQ and post the code in here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The problem with&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291363" data-lia-user-login="ERD" class="lia-mention lia-mention-user"&gt;ERD&lt;/a&gt;'s code is that it's... well, just too complex (for my taste). This precisely stems from the fact that the info I've asked about (and some more that can be deduced from the data and put in the table in a clear form) is missing from the table.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 13:50:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tickets-sent-to-and-from-a-specific-team/m-p/2880345#M93204</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-11-02T13:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: Tickets sent to and from a specific team</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tickets-sent-to-and-from-a-specific-team/m-p/2880428#M93211</link>
      <description>&lt;P&gt;I'm not so familiar with Power Query so any input is appreciated!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 14:15:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tickets-sent-to-and-from-a-specific-team/m-p/2880428#M93211</guid>
      <dc:creator>jimminy</dc:creator>
      <dc:date>2022-11-02T14:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: Tickets sent to and from a specific team</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tickets-sent-to-and-from-a-specific-team/m-p/2881036#M93258</link>
      <description>&lt;P&gt;File attached. Be prepared to see some serious M code... You'll have to adjust things here and there because I did not know how to handle the starts of ticket flows and their ends. Should they be treated as the Sent/Received actions or should they belong to their own special categories? You have not specified this... so I've assumed the event "Received" also applies to the beginning of a flow. Similarly for the "Sent" event.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 18:16:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tickets-sent-to-and-from-a-specific-team/m-p/2881036#M93258</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-11-02T18:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: Tickets sent to and from a specific team</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tickets-sent-to-and-from-a-specific-team/m-p/2885793#M93531</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="349489" data-lia-user-login="daXtreme" class="lia-mention lia-mention-user"&gt;daXtreme&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a million. I have adjusted the code and i've been able to visualize the sent and received tickets without bogging things down with DAX.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;J&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 13:36:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Tickets-sent-to-and-from-a-specific-team/m-p/2885793#M93531</guid>
      <dc:creator>jimminy</dc:creator>
      <dc:date>2022-11-04T13:36:06Z</dc:date>
    </item>
  </channel>
</rss>

