<?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 Replace conditional sum using aggr with Set expression. in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Replace-conditional-sum-using-aggr-with-Set-expression/m-p/2052905#M1223046</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Is it possible to replace the below Qlik Expression with a version that uses set expressions? I have been searching and trying like crazy, but I am stuck..&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;     sum( //sum voor de aggr..
              Aggr(
                        If(
                            ([Material_Consumption.Case_Creation_Date])&amp;gt;=(RangeMax(Min(Date_M),StartDate)) 	and
                            ([Material_Consumption.Case_Creation_Date])&amp;lt;=(RangeMin(Max(Date_M),EndDate)) 	and 
                            [Material_Consumption.Category]='Contract Covered' and 
                            ([BS] = 'Consumption - Good part' OR [BS] = 'Consumption - Reversal')
                        ,  sum([Material_Consumption.Amount_ListPrice_EUR]) 
                        , Null)
                    ,ContractId, StartDate, EndDate, ConcatKey_MC, [Material_Consumption.Case_Creation_Date], Material
                    )
                )
            )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 24 Mar 2023 11:38:52 GMT</pubDate>
    <dc:creator>StevedeP_BI2Analytics</dc:creator>
    <dc:date>2023-03-24T11:38:52Z</dc:date>
    <item>
      <title>Replace conditional sum using aggr with Set expression.</title>
      <link>https://community.qlik.com/t5/QlikView/Replace-conditional-sum-using-aggr-with-Set-expression/m-p/2052905#M1223046</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Is it possible to replace the below Qlik Expression with a version that uses set expressions? I have been searching and trying like crazy, but I am stuck..&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;     sum( //sum voor de aggr..
              Aggr(
                        If(
                            ([Material_Consumption.Case_Creation_Date])&amp;gt;=(RangeMax(Min(Date_M),StartDate)) 	and
                            ([Material_Consumption.Case_Creation_Date])&amp;lt;=(RangeMin(Max(Date_M),EndDate)) 	and 
                            [Material_Consumption.Category]='Contract Covered' and 
                            ([BS] = 'Consumption - Good part' OR [BS] = 'Consumption - Reversal')
                        ,  sum([Material_Consumption.Amount_ListPrice_EUR]) 
                        , Null)
                    ,ContractId, StartDate, EndDate, ConcatKey_MC, [Material_Consumption.Case_Creation_Date], Material
                    )
                )
            )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2023 11:38:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Replace-conditional-sum-using-aggr-with-Set-expression/m-p/2052905#M1223046</guid>
      <dc:creator>StevedeP_BI2Analytics</dc:creator>
      <dc:date>2023-03-24T11:38:52Z</dc:date>
    </item>
    <item>
      <title>Re: Replace conditional sum using aggr with Set expression.</title>
      <link>https://community.qlik.com/t5/QlikView/Replace-conditional-sum-using-aggr-with-Set-expression/m-p/2053047#M1223053</link>
      <description>&lt;P&gt;The Category and BS could be written as set expressions within the aggregations. But by the various dates it depends on the data-model and the requirements of this calculation. The set analysis worked like a selection on a column-level - this means in your regard the queried and compared date-values would be needed the same for all rows within your calculation. Otherwise if a row-level evaluation is needed because each contract, material and so on has different date-values you will need an if-loop like you have.&lt;/P&gt;
&lt;P&gt;Beside of this it might be helpful to transfer parts or the entire logic into the data-model. Maybe by resolving the start- and end-dates to a single date with an intervalmatch and/or comparing the various dates within the script by creating flags and/or offset-values ...&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2023 17:23:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Replace-conditional-sum-using-aggr-with-Set-expression/m-p/2053047#M1223053</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2023-03-24T17:23:34Z</dc:date>
    </item>
  </channel>
</rss>

