<?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 perform aggregation similar to SUMX in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/How-to-perform-aggregation-similar-to-SUMX/m-p/1794553#M62253</link>
    <description>&lt;P&gt;I think you made an error in the Min() function. You will need two Min() functions like:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;RangeSum(&lt;BR /&gt;aggr( min( [FTE Actual]&amp;nbsp; ) , [Project Name] ),&lt;BR /&gt;aggr( min( [FTE Allocated] ) , [Project Name] ),&lt;BR /&gt;) / [FTE Allocated]&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;-Rob&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 25 Mar 2021 16:07:52 GMT</pubDate>
    <dc:creator>rwunderlich</dc:creator>
    <dc:date>2021-03-25T16:07:52Z</dc:date>
    <item>
      <title>How to perform aggregation similar to SUMX</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-perform-aggregation-similar-to-SUMX/m-p/1794457#M62240</link>
      <description>&lt;P&gt;Hello Community,&lt;/P&gt;&lt;P&gt;I'm fairly new to Qlik Sense and working to recreate a dashboard I previously created in Excel Power Pivot / Power BI.&amp;nbsp; I've successfully recreated most of the data model; however, I'm really stuck recreating one particular measure where I used SUMX in Power Pivot.&lt;/P&gt;&lt;P&gt;Here's the data model view in Qlik Sense Enterprise:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="joshiroc_0-1616674371105.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/51813iD63F0FC57FA7FAFD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="joshiroc_0-1616674371105.png" alt="joshiroc_0-1616674371105.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The measure I am attempting to recreate from Power Pivot it:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;Adherence:=sumx( 'Project Mapping', min( [FTE.Actual] , [FTE.Allocated] ) ) / [FTE.Allocated]&lt;/P&gt;&lt;P&gt;If you are not familiar with DAX (and I am far from an expert), this expression sums the minimum of Actual and Allocation for each row in the 'Project Mapping' table and divides by the total allocation.&amp;nbsp; [FTE.Actual] and [FTE.Allocated] are both measures with their own underlying formulas.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In Qlik Sense, I have the following expression (which is not working and returning 0 regardless of selections):&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;[Adherence] = sum( aggr( min( [FTE Actual] , [FTE Allocated] ) , [Project Name] ) ) / [FTE Allocated]&lt;/P&gt;&lt;P&gt;And here are the measures that are used within the Adherence measure, which all appear to be calculating correctly:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;[FTE Actual] =&amp;nbsp;[Total Hours] / (8 * [TotalWorkDays])&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;[TotalWorkDays] = Count({$&amp;lt;[Date] = {"&amp;lt;=$(=$(v_LastWorkedDate))"}, [DayOfWeek] = {"&amp;lt;5"}, [Is Holiday] = {0}, [Source] = {"Actuals"}&amp;gt;} [Date])&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;[Total Hours] =&amp;nbsp;Sum([Actual Hours])&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;v_LastWorkedDate =&amp;nbsp;'max({$&amp;lt;[Actual Hours] = {"&amp;gt; 0"} &amp;gt;} [DateKey])'&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;[FTE Allocated] =&amp;nbsp;sum( [FTE] )&lt;/P&gt;&lt;P&gt;Here's a screenshot of a pivot table where you can see [FTE Actual] and [FTE Allocated] are calculating correctly, but [Adherence] is returning 0:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="joshiroc_0-1616679325398.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/51820i492426E3312581F2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="joshiroc_0-1616679325398.png" alt="joshiroc_0-1616679325398.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am really lost on why [Adherence] doesn't work.&amp;nbsp; Any thoughts on what I might try or do differently?&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 17:21:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-perform-aggregation-similar-to-SUMX/m-p/1794457#M62240</guid>
      <dc:creator>joshiroc</dc:creator>
      <dc:date>2024-11-16T17:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform aggregation similar to SUMX</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-perform-aggregation-similar-to-SUMX/m-p/1794553#M62253</link>
      <description>&lt;P&gt;I think you made an error in the Min() function. You will need two Min() functions like:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;RangeSum(&lt;BR /&gt;aggr( min( [FTE Actual]&amp;nbsp; ) , [Project Name] ),&lt;BR /&gt;aggr( min( [FTE Allocated] ) , [Project Name] ),&lt;BR /&gt;) / [FTE Allocated]&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;-Rob&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 16:07:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-perform-aggregation-similar-to-SUMX/m-p/1794553#M62253</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2021-03-25T16:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform aggregation similar to SUMX</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-perform-aggregation-similar-to-SUMX/m-p/1794606#M62256</link>
      <description>&lt;P&gt;Thanks very much for the response Rob.&amp;nbsp; I am not yet able to determine if your suggestion will get me over the hurdle or not as I apparently don't understand how all of the selections are applied in conjunction with pivot tables either.&lt;/P&gt;&lt;P&gt;I have now unfortunately realized that[FTE Actual] is not being calculated correctly as originally thought, and digging deeper I appears the problem lies within [TotalWorkDays] calculation.&amp;nbsp; I need to fix that problem first before getting back to the other expression.&lt;/P&gt;&lt;P&gt;What I need [TotalWorkDays] to calculate is the number of work days within a selected time period that a resource is available.&amp;nbsp; You can see in the table below that [TotalWorkDays] is presently calculating the number of days a resource works on a particular project.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="joshiroc_1-1616696248413.png" style="width: 778px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/51848i408709335421A5E8/image-dimensions/778x144?v=v2" width="778" height="144" role="button" title="joshiroc_1-1616696248413.png" alt="joshiroc_1-1616696248413.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here's what I know does not work as desired [TotalWorkDays] =:&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;Count({$&amp;lt;[Date] = {"&amp;lt;=$(=$(v_LastWorkedDate))"}, [DayOfWeek] = {"&amp;lt;5"}, [Is Holiday] = {0}, [Source] = {"Actuals"}&amp;gt;} [Date])&lt;/SPAN&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;In this case v_LastWorkedDate calculates as expected outside the pivot table, but within the pivot table returns the last date worked on a particular project&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;&amp;nbsp;Count({$&amp;lt;[DayOfWeek] = {"&amp;lt;5"}, [Is Holiday] = {0}, [Source] = {"Actuals"}, [Dummy Project ID]&amp;gt;} [Date])&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thoughts on how to make [TotalWorkDays] behave as desired both inside and outside the pivot table?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 18:43:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-perform-aggregation-similar-to-SUMX/m-p/1794606#M62256</guid>
      <dc:creator>joshiroc</dc:creator>
      <dc:date>2021-03-25T18:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform aggregation similar to SUMX</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-perform-aggregation-similar-to-SUMX/m-p/1794614#M62257</link>
      <description>&lt;P&gt;You don't show what the expression in&amp;nbsp;&lt;SPAN&gt;v_LastWorkedDate is, but I imagine it's something like&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;max(Date)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When you calculate that in the chart, you are going to get max(Date) for the row dimensions, in this case Resource &amp;amp;&amp;nbsp; Project. If you want the max value from only Resource, you will need to adjust your max date expression to use a total keyword like:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Max(Total&amp;lt;Resource&amp;gt; Date)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;-Rob&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 19:32:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-perform-aggregation-similar-to-SUMX/m-p/1794614#M62257</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2021-03-25T19:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform aggregation similar to SUMX</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-perform-aggregation-similar-to-SUMX/m-p/1794657#M62262</link>
      <description>&lt;P&gt;&lt;SPAN&gt;The definition of v_LastWorkedDate was in the original post, and the behavior was not as desired when used in a pivot table.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However, your hint to TOTAL tipped me off a bit and I made some great strides in the right direction now.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Key learnings thus far:&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;TOTAL is used to disregard dimension values in tables/charts&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Set expressions are used to override selections&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;So now using TOTAL in the v_LastWorkedDate with the fields I do not want to disregard in "&amp;lt;&amp;gt;":&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;v_LastWorkedDate = max(total&amp;lt;[Dummy Resource ID], [Month]&amp;gt; {&amp;lt;[Actual Hours] = {"&amp;gt; 0"}&amp;gt;} [DateKey])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;And similarly&amp;nbsp;for TotalWorkDays:&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;TotalWorkDays = Count(total&amp;lt;[Month]&amp;gt; {$&amp;lt;[Date] = {"&amp;lt;=$(=$(v_LastWorkedDate))"}, [DayOfWeek] = {"&amp;lt;5"}, [Is Holiday] = {0}, [Source] = {"Actuals"}&amp;gt;} [Date])&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I now get a pivot table that appears to calculate those two expressions correctly:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="joshiroc_0-1616706262337.png" style="width: 749px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/51856iA054D3DDCEE75FEF/image-dimensions/749x219?v=v2" width="749" height="219" role="button" title="joshiroc_0-1616706262337.png" alt="joshiroc_0-1616706262337.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm also a bit closer on the Adherence calculation, but not quite there.&amp;nbsp; When the Resource dimension is expanded in the pivot table like above, Adherence calculates correctly.&amp;nbsp; When I collapse the Resource dimension it's not calculating correctly and I know I need an AGGR in there somewhere but can't get it right.&amp;nbsp; For example, for Resource Number 57, the correct total Adherence would be (0.25 + 0.3) / 0.95 = 57.8%.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="joshiroc_1-1616706416787.png" style="width: 753px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/51857iD1875ADBB8BC688F/image-dimensions/753x241?v=v2" width="753" height="241" role="button" title="joshiroc_1-1616706416787.png" alt="joshiroc_1-1616706416787.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I've tried the below expression (plus others) to no avail:&lt;/P&gt;&lt;P&gt;sum(aggr(Rangemin( [FTE Actual], [FTE Allocated] ),[Dummy Project ID])) / [FTE Allocated]&lt;/P&gt;&lt;P&gt;Thoughts again please!?!&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 21:12:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-perform-aggregation-similar-to-SUMX/m-p/1794657#M62262</guid>
      <dc:creator>joshiroc</dc:creator>
      <dc:date>2021-03-25T21:12:31Z</dc:date>
    </item>
  </channel>
</rss>

