<?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: Using Aggr() and and DISTINCT and calculate average value in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Using-Aggr-and-and-DISTINCT-and-calculate-average-value/m-p/1578517#M42174</link>
    <description>&lt;P&gt;What is the exact output you are hoping to see?&lt;/P&gt;</description>
    <pubDate>Thu, 09 May 2019 14:10:50 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2019-05-09T14:10:50Z</dc:date>
    <item>
      <title>Using Aggr() and and DISTINCT and calculate average value</title>
      <link>https://community.qlik.com/t5/App-Development/Using-Aggr-and-and-DISTINCT-and-calculate-average-value/m-p/1578442#M42157</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a file with warehouse input transactions. I want to figure out how many different suppliers i receive goods from each day. Then I want in front end to calculate the average value for each month&lt;/P&gt;&lt;P&gt;&amp;nbsp;The file look like this&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;&lt;EM&gt;Transdate&lt;/EM&gt;&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;&lt;EM&gt;Package&lt;/EM&gt;&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;&lt;EM&gt;Supplier&lt;/EM&gt;&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20190101&lt;/TD&gt;&lt;TD&gt;1245654&lt;/TD&gt;&lt;TD&gt;Supplier 1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20190101&lt;/TD&gt;&lt;TD&gt;5242575&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Supplier 2&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20190101&lt;/TD&gt;&lt;TD&gt;5242576&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Supplier 1&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20190102&lt;/TD&gt;&lt;TD&gt;5242589&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Supplier 3&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20190104&lt;/TD&gt;&lt;TD&gt;5242564&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Supplier 1&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20190104&lt;/TD&gt;&lt;TD&gt;5242523&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Supplier 1&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20190105&lt;/TD&gt;&lt;TD&gt;5242509&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Supplier 1&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20190106&lt;/TD&gt;&lt;TD&gt;5242551&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Supplier 5&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20190106&lt;/TD&gt;&lt;TD&gt;5242523&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Supplier 1&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying in frontend to calculate how many different suppliers it is per transaction date by using the Aggr function and then calculate the average value for each day and present it per month:&lt;/P&gt;&lt;P&gt;Avg (Aggr(Count(Distinct Supplier),TransDate))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 20:54:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-Aggr-and-and-DISTINCT-and-calculate-average-value/m-p/1578442#M42157</guid>
      <dc:creator>magnusrydberg</dc:creator>
      <dc:date>2024-11-16T20:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using Aggr() and and DISTINCT and calculate average value</title>
      <link>https://community.qlik.com/t5/App-Development/Using-Aggr-and-and-DISTINCT-and-calculate-average-value/m-p/1578485#M42164</link>
      <description>&lt;P&gt;Hi Magnus,&lt;/P&gt;&lt;P&gt;You are doing it good, except for the Trans&lt;STRONG&gt;D&lt;/STRONG&gt;ate, which should be Transdate. If you make a month column Month(Date(Date#(Transdate,'YYYYMMDD'),'DD-MM-YYYY')), put this in a bar chart and get your correctly spelled formula, then it will work!&lt;/P&gt;&lt;P&gt;Jordy&lt;/P&gt;&lt;P&gt;Climber&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 13:45:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-Aggr-and-and-DISTINCT-and-calculate-average-value/m-p/1578485#M42164</guid>
      <dc:creator>JordyWegman</dc:creator>
      <dc:date>2019-05-09T13:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: Using Aggr() and and DISTINCT and calculate average value</title>
      <link>https://community.qlik.com/t5/App-Development/Using-Aggr-and-and-DISTINCT-and-calculate-average-value/m-p/1578494#M42167</link>
      <description>&lt;P&gt;Hi Jordy,&lt;/P&gt;&lt;P&gt;I'm afraid I did the wrong spelling in this question. In my expression in the it's spelled correct.&lt;/P&gt;&lt;P&gt;The problem for me is that it I've got the value of one for every day so the mean value for the month is also the value of one....&lt;/P&gt;&lt;P&gt;What am i doing wrong?&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;// Magnus&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 13:52:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-Aggr-and-and-DISTINCT-and-calculate-average-value/m-p/1578494#M42167</guid>
      <dc:creator>magnusrydberg</dc:creator>
      <dc:date>2019-05-09T13:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using Aggr() and and DISTINCT and calculate average value</title>
      <link>https://community.qlik.com/t5/App-Development/Using-Aggr-and-and-DISTINCT-and-calculate-average-value/m-p/1578498#M42168</link>
      <description>&lt;P&gt;Hi Jordy,&lt;/P&gt;&lt;P&gt;I'm afraid I did the wrong spelling in this question. In my expression in the it's spelled correct.&lt;/P&gt;&lt;P&gt;The problem for me is that it I've got the value of one for every day so the mean value for the month is also the value of one....&lt;/P&gt;&lt;P&gt;What am i doing wrong?&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;Magnus&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 13:53:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-Aggr-and-and-DISTINCT-and-calculate-average-value/m-p/1578498#M42168</guid>
      <dc:creator>magnusrydberg</dc:creator>
      <dc:date>2019-05-09T13:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: Using Aggr() and and DISTINCT and calculate average value</title>
      <link>https://community.qlik.com/t5/App-Development/Using-Aggr-and-and-DISTINCT-and-calculate-average-value/m-p/1578499#M42169</link>
      <description>&lt;P&gt;Is there a way you could show us what your "correct" table would look like?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 13:54:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-Aggr-and-and-DISTINCT-and-calculate-average-value/m-p/1578499#M42169</guid>
      <dc:creator>JustinDallas</dc:creator>
      <dc:date>2019-05-09T13:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: Using Aggr() and and DISTINCT and calculate average value</title>
      <link>https://community.qlik.com/t5/App-Development/Using-Aggr-and-and-DISTINCT-and-calculate-average-value/m-p/1578517#M42174</link>
      <description>&lt;P&gt;What is the exact output you are hoping to see?&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 14:10:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-Aggr-and-and-DISTINCT-and-calculate-average-value/m-p/1578517#M42174</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-05-09T14:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: Using Aggr() and and DISTINCT and calculate average value</title>
      <link>https://community.qlik.com/t5/App-Development/Using-Aggr-and-and-DISTINCT-and-calculate-average-value/m-p/1578519#M42175</link>
      <description>&lt;P&gt;I want a result table like this :&lt;/P&gt;&lt;P&gt;and that the mean value for 201901 would be 2+1+1+1+1+2=7 divided with 5=1,4&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;&lt;EM&gt;Transdate&lt;/EM&gt;&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;Number of suppler&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20190101&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20190102&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20190104&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20190105&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20190106&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want the mean value for 201901 would be 2+1+1+1+1+2=7 divided with 5=1,4 &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Magnus&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 14:11:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-Aggr-and-and-DISTINCT-and-calculate-average-value/m-p/1578519#M42175</guid>
      <dc:creator>magnusrydberg</dc:creator>
      <dc:date>2019-05-09T14:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using Aggr() and and DISTINCT and calculate average value</title>
      <link>https://community.qlik.com/t5/App-Development/Using-Aggr-and-and-DISTINCT-and-calculate-average-value/m-p/1578521#M42176</link>
      <description>&lt;P&gt;In that case, your expression looks good to me... Are you using YearMonth as your dimension where you are not seeing 1.4 for 201901?&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 14:18:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-Aggr-and-and-DISTINCT-and-calculate-average-value/m-p/1578521#M42176</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-05-09T14:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using Aggr() and and DISTINCT and calculate average value</title>
      <link>https://community.qlik.com/t5/App-Development/Using-Aggr-and-and-DISTINCT-and-calculate-average-value/m-p/1578546#M42180</link>
      <description>&lt;P&gt;Yes I'm using YearMonth as the dimension &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;My expression in front end:&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;AVG (Aggr((Count(Distinct If (PBLCType='Via BLC' or LP_Supplier='AHLS_SU',LP_Supplier))),PBLCDate))&lt;/P&gt;&lt;P&gt;The dimesion is PYearMonth.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;My Sqript:&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;// Warehouse transactionsLOAD PackageNo as PPackageNo,&lt;BR /&gt;PackageNoSeq as PPackageNoSeq,&lt;BR /&gt;PackageNo&amp;amp;PackageNoSeq as PPackage,&lt;BR /&gt;TransactionDateTime as PTransactionDateTime,&lt;BR /&gt;FromCompany as PFromCompany,&lt;BR /&gt;if (FromCompany='$(CompanyConst2)','Via BLC','Direkt') as [PBLCType],&lt;BR /&gt;FromFacility as PFromFacility,&lt;BR /&gt;FromWarehouse as PFromWarehouse,&lt;BR /&gt;FromLocation as PFromLocation,&lt;BR /&gt;FromContainer as PFromContainer,&lt;BR /&gt;ToCompany as PToCompany,&lt;BR /&gt;ToFacility as PToFacility,&lt;BR /&gt;ToWarehouse as PToWarehouse ,&lt;BR /&gt;ToLocation as PToLocation,&lt;BR /&gt;ToContainer as PToContainer,&lt;BR /&gt;Date(CreatedDateTime) as PCreatedDate,&lt;BR /&gt;dual( Year(CreatedDateTime) &amp;amp; '-' &amp;amp; Month(CreatedDateTime), num(Year(CreatedDateTime)) &amp;amp; num(Month(CreatedDateTime), '00' )) as [PYearMonth],&lt;BR /&gt;dual( Year(CreatedDateTime) &amp;amp; '-' &amp;amp; Week(CreatedDateTime), num(Year(CreatedDateTime)) &amp;amp; num(Week(CreatedDateTime), '00' )) as [PYearWeek],&lt;BR /&gt;text(date(CreatedDateTime,'YYYY-MM')) as KPIYearMonth,&lt;BR /&gt;Year (CreatedDateTime) as [PYear],&lt;BR /&gt;Month(CreatedDateTime) as [PMonth],&lt;BR /&gt;WeekDay(CreatedDateTime) as [Pday],&lt;BR /&gt;Hour(CreatedDateTime) as [PHour];&lt;BR /&gt;SQL SELECT *FROM lsp.PackageTransactions where ToCompany='$(CompanyConst1)' and FromCompany&amp;lt;&amp;gt;'$(CompanyConst1)' and CreatedDateTime&amp;gt;'$(Datelimit)';&lt;/P&gt;&lt;P&gt;Inner Join&lt;BR /&gt;LOAD&lt;BR /&gt;Contractor as [PToCompany],&lt;BR /&gt;ProjectId as [PToFacility],&lt;BR /&gt;ProjectName as [PToProjectName];&lt;BR /&gt;SQL SELECT *&lt;BR /&gt;FROM lsp.ConstructionProject;&lt;/P&gt;&lt;P&gt;Inner Join&lt;BR /&gt;LOAD PackageNo as PPackageNo,&lt;BR /&gt;PackageNoSeq as PPackageNoSeq,&lt;BR /&gt;Description as PDescription,&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;Supplier as LP_Supplier,&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;if (BuildingId='AH','Avhämtat','Uppburet') as [PDelType],&lt;BR /&gt;BuildingId as PBuildingId,&lt;BR /&gt;PackageType as PPackageType,&lt;BR /&gt;DeliveryId as PDeliveryId,&lt;BR /&gt;ProjectSubId as PProjectSubId,&lt;BR /&gt;CreatedBy as PCreatedBy;&lt;BR /&gt;SQL SELECT * FROM lsp.Package;&lt;/P&gt;&lt;P&gt;Left Join&lt;BR /&gt;LOAD Person as PCreatedBy,&lt;BR /&gt;Company as PCompany;&lt;BR /&gt;SQL SELECT * FROM "myloc_PROD_220".cabase.CompanyPersons;&lt;/P&gt;&lt;P&gt;Inner Join&lt;BR /&gt;LOAD&lt;BR /&gt;Contractor as [PToCompany],&lt;BR /&gt;ProjectId as [PToFacility],&lt;BR /&gt;ProjectSubId as PProjectSubId,&lt;BR /&gt;ProjectSubId as KPIProjectSubId,&lt;BR /&gt;StatisticalGroupId as PStatisticalGroupId,&lt;BR /&gt;if(len(StatisticalGroupId)&amp;gt;0,StatisticalGroupId,'Saknas') as KPIStatisticalGroupId,&lt;BR /&gt;SubContractorId as PSubContractorID;&lt;BR /&gt;SQL SELECT *&lt;BR /&gt;FROM lsp.ConstructionProjectSubMaster;&lt;BR /&gt;&lt;BR /&gt;Left Join&lt;BR /&gt;LOAD&lt;BR /&gt;PackageNo as PPackageNo,&lt;BR /&gt;PackageNoSeq as PPackageNoSeq,&lt;BR /&gt;PackageNo&amp;amp;PackageNoSeq as PPackage,&lt;BR /&gt;TransactionDateTime as PTransactionDateTime,&lt;BR /&gt;Date(CreatedDateTime) as &lt;EM&gt;&lt;STRONG&gt;PBLCDate;&lt;/STRONG&gt; &lt;/EM&gt;&lt;BR /&gt;SQL SELECT *FROM lsp.PackageTransactions where ToCompany='$(CompanyConst1)' and FromCompany='$(CompanyConst2)' and CreatedDateTime&amp;gt;'$(Datelimit)';&lt;/P&gt;&lt;P&gt;Hope you can help me &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;// Magnus&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 14:38:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-Aggr-and-and-DISTINCT-and-calculate-average-value/m-p/1578546#M42180</guid>
      <dc:creator>magnusrydberg</dc:creator>
      <dc:date>2019-05-09T14:38:07Z</dc:date>
    </item>
  </channel>
</rss>

