<?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: calculate estimated service date in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-estimated-service-date/m-p/2957240#M98286</link>
    <description>&lt;P&gt;I missed that there was a team table as well as capacity, which is why I thought it would have to be many to many. one-to-many is much better. try this amended code&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Date to start = VAR CurrentRank = SELECTEDVALUE( 'Tickets'[rank])
VAR CurrentTeam = SELECTEDVALUE( 'Tickets'[Assigned to Team])
VAR EffortBeforeCurrentTicket = 
	CALCULATE( 
		SUM( 'Tickets'[Estimated effort in hours]), 
		REMOVEFILTERS( 'Tickets'),
		'Tickets'[rank] &amp;lt;= CurrentRank &amp;amp;&amp;amp; 'Tickets'[Assigned to Team] = CurrentTeam
	)
VAR CapacityTable =
	ADDCOLUMNS(
		CALCULATETABLE(
			SUMMARIZE( 'Team Capacity', 'Date'[Date] ),
			'Date'[Date] &amp;gt;= TODAY()
		),
		"Total Capacity End Of Day",
		VAR  CurrentVisibleDate = 'Date'[Date]
		RETURN
		CALCULATE( SUM( 'Team Capacity'[Capacity in hours] ), 
			'Date'[Date] &amp;lt;= CurrentVisibleDate &amp;amp;&amp;amp; 'Date'[Date] &amp;gt;= TODAY(),
            TREATAS( { CurrentTeam }, 'Team'[Team] )
		)
	)
VAR DateOfStart = MINX(
	FILTER( CapacityTable, [Total Capacity End Of Day] &amp;gt;= EffortBeforeCurrentTicket),
	'Date'[Date]
)
RETURN DateOfStart&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 08 Dec 2022 16:00:35 GMT</pubDate>
    <dc:creator>johnt75</dc:creator>
    <dc:date>2022-12-08T16:00:35Z</dc:date>
    <item>
      <title>calculate estimated service date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-estimated-service-date/m-p/2956469#M98224</link>
      <description>&lt;P&gt;I'm working on the following use case:&lt;BR /&gt;&lt;BR /&gt;It involves a service desk and the estimated date that a ticket will be processed. At any certain day, there will be an X amount of capacity per team to process tickets (eg 20 hrs on 2022-12-8, 15 on 2022-12-9 etc). Each ticket contains an estimated effort to complete it. The challenge is to estimate when a ticket will be picked up by the service desk based off the ticket rank and the available capacity.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Tables:&lt;/P&gt;&lt;P&gt;Capacity&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Team&lt;/TD&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Capacity in hours&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;a&lt;/TD&gt;&lt;TD&gt;2022-12-8&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; &amp;nbsp; 20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;TD&gt;2022-12-8&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; &amp;nbsp; 30&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;a&lt;/TD&gt;&lt;TD&gt;2022-12-9&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; &amp;nbsp; 15&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;TD&gt;2022-12-9&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; &amp;nbsp; 25&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tickets (filtered status = Open)&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;rank&lt;/TD&gt;&lt;TD&gt;Assigned to Team&lt;/TD&gt;&lt;TD&gt;Estimated effort in hours&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;a&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;a&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;a&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;b&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Capacity table is connected to date table and team table. Ticket table is only connected to team table (since I need to calculate the estimated date still)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Goal:&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my example, tickets rank 1 and 2 will be processed on 2022-12-8 by team a, and ticket rank 4 will be processed on 2022-12-9.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I've come as far to calculate&amp;nbsp; on a per day basis (=capacity 8 hours per day) using Current Date as a starting point in the following measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Estimated date =&amp;nbsp;&lt;/P&gt;&lt;P&gt;--calculate estimated effort in days&lt;/P&gt;&lt;P&gt;var _remwork = DIVIDE (CALCULATE(SUM(Tickets[Estimated Effort]), FILTER(ALL(Tickets),Tickets[Rank]&amp;lt;SELECTEDVALUE(Tickets[Rank]))),8,0)&lt;BR /&gt;var _currentDate = Today()&lt;BR /&gt;var _networkingdays = FILTER(ALL(Datum),Datum[Datum]&amp;gt;_currentDate &amp;amp;&amp;amp; Datum[Weekday] = "Yes")&lt;BR /&gt;var _Datecomplete = TOPN(ROUND(_remwork,0),_networkingdays,Datum[Datum],asc)&lt;BR /&gt;var _result = MAXX(_Datecomplete,Datum[Datum])&lt;BR /&gt;return&lt;BR /&gt;_result&lt;BR /&gt;&lt;BR /&gt;I'm struggling to compare the actual capacity per given date with the cumulative estimated effort of all tickets. That means that in the first step, calculating the effort, I somehow have to incorporate the available capacity and when the cumulative estimated effort exceeds this for any given day, it will add a day to the estimated date and so on. What I can't seem to wrap my head around is that the capacity has assigned dates, but the tickets have not, making it hard to compare it on that dimension.&amp;nbsp; Any idea is welcome (DAX, Power Query, both).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 14:21:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-estimated-service-date/m-p/2956469#M98224</guid>
      <dc:creator>joris</dc:creator>
      <dc:date>2022-12-08T14:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: calculate estimated service date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-estimated-service-date/m-p/2957190#M98281</link>
      <description>&lt;P&gt;If you have a many-to-many bidirectional filter between team and ticket, you can try&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Date to start = VAR CurrentRank = SELECTEDVALUE( 'Tickets'[rank])
VAR CurrentTeam = SELECTEDVALUE( 'Tickets'[Assigned to Team])
VAR EffortBeforeCurrentTicket = 
	CALCULATE( 
		SUM( 'Tickets'[Estimated effort in hours]), 
		REMOVEFILTERS( 'Tickets'),
		'Tickets'[rank] &amp;lt;= CurrentRank &amp;amp;&amp;amp; 'Tickets'[Assigned to Team] = CurrentTeam
	)
VAR CapacityTable =
	ADDCOLUMNS(
		CALCULATETABLE(
			SUMMARIZE( 'Team Capacity', 'Date'[Date] ),
			'Date'[Date] &amp;gt;= TODAY()
		),
		"Total Capacity End Of Day",
		VAR  CurrentVisibleDate = 'Date'[Date]
		RETURN
		CALCULATE( SUM( 'Team Capacity'[Capacity in hours] ), 
			'Date'[Date] &amp;lt;= CurrentVisibleDate &amp;amp;&amp;amp; 'Date'[Date] &amp;gt;= TODAY()
		)
	)
VAR DateOfStart = MINX(
	FILTER( CapacityTable, [Total Capacity End Of Day] &amp;gt;= EffortBeforeCurrentTicket),
	'Date'[Date]
)
RETURN DateOfStart&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 08 Dec 2022 15:33:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-estimated-service-date/m-p/2957190#M98281</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-12-08T15:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: calculate estimated service date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-estimated-service-date/m-p/2957231#M98283</link>
      <description>&lt;P&gt;thanks, I found a Power Query solution, but I'll definitely try this one as well.&amp;nbsp;&lt;BR /&gt;The relationship between Team and Ticket is one-to-many, does that matter? I can set the filter to bidirectional off course....&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 15:53:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-estimated-service-date/m-p/2957231#M98283</guid>
      <dc:creator>joris</dc:creator>
      <dc:date>2022-12-08T15:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: calculate estimated service date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-estimated-service-date/m-p/2957240#M98286</link>
      <description>&lt;P&gt;I missed that there was a team table as well as capacity, which is why I thought it would have to be many to many. one-to-many is much better. try this amended code&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Date to start = VAR CurrentRank = SELECTEDVALUE( 'Tickets'[rank])
VAR CurrentTeam = SELECTEDVALUE( 'Tickets'[Assigned to Team])
VAR EffortBeforeCurrentTicket = 
	CALCULATE( 
		SUM( 'Tickets'[Estimated effort in hours]), 
		REMOVEFILTERS( 'Tickets'),
		'Tickets'[rank] &amp;lt;= CurrentRank &amp;amp;&amp;amp; 'Tickets'[Assigned to Team] = CurrentTeam
	)
VAR CapacityTable =
	ADDCOLUMNS(
		CALCULATETABLE(
			SUMMARIZE( 'Team Capacity', 'Date'[Date] ),
			'Date'[Date] &amp;gt;= TODAY()
		),
		"Total Capacity End Of Day",
		VAR  CurrentVisibleDate = 'Date'[Date]
		RETURN
		CALCULATE( SUM( 'Team Capacity'[Capacity in hours] ), 
			'Date'[Date] &amp;lt;= CurrentVisibleDate &amp;amp;&amp;amp; 'Date'[Date] &amp;gt;= TODAY(),
            TREATAS( { CurrentTeam }, 'Team'[Team] )
		)
	)
VAR DateOfStart = MINX(
	FILTER( CapacityTable, [Total Capacity End Of Day] &amp;gt;= EffortBeforeCurrentTicket),
	'Date'[Date]
)
RETURN DateOfStart&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 08 Dec 2022 16:00:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/calculate-estimated-service-date/m-p/2957240#M98286</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-12-08T16:00:35Z</dc:date>
    </item>
  </channel>
</rss>

