<?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: How to calculate the average of the 'first response' time per conversation ID in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-the-average-of-the-first-response-time-per/m-p/2472604#M67390</link>
    <description>&lt;P&gt;Thank your for pointing me in the right direction! I changed your measure to the following:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;P&gt;Response Time =&lt;/P&gt;&lt;P&gt;VAR _conversation_created_at =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;MINX(&lt;BR /&gt;'table',&lt;BR /&gt;'table'[created_at]&lt;BR /&gt;),&lt;BR /&gt;'table'[is_interaction] = 1&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR _conversation_response_created_at =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;MINX(&lt;BR /&gt;'table',&lt;BR /&gt;'table'[created_at]&lt;BR /&gt;),&lt;BR /&gt;'table'[owner_type] = "Agent",&lt;BR /&gt;'table'[owner_id] &amp;lt;&amp;gt; 1,&lt;BR /&gt;'table'[created_at] &amp;gt; _conversation_created_at&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR _result = DATEDIFF(_conversation_created_at, _conversation_response_created_at, MINUTE)&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;_result&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;With this measure, I created a new measure to calculate the average of all conversations:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Response Time (AVG) = AVERAGEX(VALUES('table'[conversation_id]), [Response Time])&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Sat, 23 Apr 2022 10:08:14 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-04-23T10:08:14Z</dc:date>
    <item>
      <title>How to calculate the average of the 'first response' time per conversation ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-the-average-of-the-first-response-time-per/m-p/2468808#M67154</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following table in Power BI:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;BR /&gt;&lt;BR /&gt;In DAX, I want to calculate the average of the 'first response' time per conversation ID .&lt;BR /&gt;&lt;BR /&gt;Variable X = the 'created_at' variable from the first row where is_interaction = 1 (MARKED AS ORANGE)&lt;/P&gt;&lt;P&gt;Variable Y = the 'created_at' variable from the first row where owner_type = "Agent" after the first row where is_interaction = 1 (MARKED AS YELLOW)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With these variables I would like to calculate the difference from Y and X from each 'conversation_id',&amp;nbsp;preferably in minutes (MARKED AS BLUE).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas on how to achieve this?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 11:30:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-the-average-of-the-first-response-time-per/m-p/2468808#M67154</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-04-21T11:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the average of the 'first response' time per conversation ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-the-average-of-the-first-response-time-per/m-p/2469059#M67167</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Response Time = 

VAR _conversion_id = MAX('Table'[conversion_id])
VAR _conversation_created_at = 
	CALCULATE(
		MINX(
			'Table',
			'Table'[created_at]
		),
	REMOVEFILTERS('Table'),
	'Table'[conversion_id] = _conversion_id,
	'Table'[owner_type] = "Traveller",
	'Table'[is_interaction] = 1
	)

VAR _conversation_response_created_at = 
	CALCULATE(
		MINX(
			'Table',
			'Table'[created_at]
		),
	REMOVEFILTERS('Table'),
	'Table'[conversion_id] = _conversion_id,
	'Table'[owner_type] = "Agent"
	)

VAR _result = 
	FORMAT(
	_conversation_response_created_at - _conversation_created_at,
	"hh:nn:ss"
	)

RETURN
	IF(
		'Table'[owner_type] = "Agent"
		&amp;amp;&amp;amp; 'Table'[created_at] = _conversation_response_created_at
		&amp;amp;&amp;amp; NOT ISBLANK(_conversation_created_at),
		_result
	)&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;In case (I assume from the business logic I see in your table) there can't be 1 in&amp;nbsp; &lt;SPAN&gt;'Table'[is_interaction] unless an agent has actually responed, and there can't be a situation where an agent repsoneded without a traveller starting a request you can actually remove some redundent lines of code to make it like this:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Response Time = 

VAR _conversion_id = MAX('Table'[conversion_id])
VAR _conversation_created_at = 
	CALCULATE(
		MINX(
			'Table',
			'Table'[created_at]
		),
	REMOVEFILTERS('Table'),
	'Table'[conversion_id] = _conversion_id,
	'Table'[owner_type] = "Traveller"
	)

VAR _conversation_response_created_at = 
	CALCULATE(
		MINX(
			'Table',
			'Table'[created_at]
		),
	REMOVEFILTERS('Table'),
	'Table'[conversion_id] = _conversion_id,
	'Table'[owner_type] = "Agent"
	)

VAR _result = 
	FORMAT(
	_conversation_response_created_at - _conversation_created_at,
	"hh:nn:ss"
	)

RETURN
	IF(
		'Table'[owner_type] = "Agent"
		&amp;amp;&amp;amp; 'Table'[created_at] = _conversation_response_created_at,
		_result
	)&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 12:54:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-the-average-of-the-first-response-time-per/m-p/2469059#M67167</guid>
      <dc:creator>SpartaBI</dc:creator>
      <dc:date>2022-04-21T12:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the average of the 'first response' time per conversation ID</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-the-average-of-the-first-response-time-per/m-p/2472604#M67390</link>
      <description>&lt;P&gt;Thank your for pointing me in the right direction! I changed your measure to the following:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;P&gt;Response Time =&lt;/P&gt;&lt;P&gt;VAR _conversation_created_at =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;MINX(&lt;BR /&gt;'table',&lt;BR /&gt;'table'[created_at]&lt;BR /&gt;),&lt;BR /&gt;'table'[is_interaction] = 1&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR _conversation_response_created_at =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;MINX(&lt;BR /&gt;'table',&lt;BR /&gt;'table'[created_at]&lt;BR /&gt;),&lt;BR /&gt;'table'[owner_type] = "Agent",&lt;BR /&gt;'table'[owner_id] &amp;lt;&amp;gt; 1,&lt;BR /&gt;'table'[created_at] &amp;gt; _conversation_created_at&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR _result = DATEDIFF(_conversation_created_at, _conversation_response_created_at, MINUTE)&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;_result&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;With this measure, I created a new measure to calculate the average of all conversations:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Response Time (AVG) = AVERAGEX(VALUES('table'[conversation_id]), [Response Time])&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 23 Apr 2022 10:08:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-calculate-the-average-of-the-first-response-time-per/m-p/2472604#M67390</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-04-23T10:08:14Z</dc:date>
    </item>
  </channel>
</rss>

