<?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 sum based on values in different time period in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-sum-based-on-values-in-different-time-period/m-p/51907#M787856</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This seems to be for a chart, right? Why not check with an if statement to remove those rows which are have 0 or null&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If(Len(Trim(Expression1)) = 0 or Expression1 = 0 (Len(Trim(Expression2)) = 0 or Expression2 = 0), Expression1)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG&gt;If(Len(Trim(Expression1)) = 0 or Expression1 = 0 (Len(Trim(Expression2)) = 0 or Expression2 = 0), Expression2)&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Feb 2018 17:17:41 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2018-02-20T17:17:41Z</dc:date>
    <item>
      <title>How to sum based on values in different time period</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-sum-based-on-values-in-different-time-period/m-p/51906#M787855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear people,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wish to sum revenue for customer/article combinations in period 1 partially based on values in period 2 (or visa versa). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;General background:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Recently within our company we started to use Qlik Sense as our BI tool with a dataset created by an external Qlik consultant. Tis upon me to recreate a few KPIs, originally calculated in Excel, in Qlik. Our department specializes in pricing strategy and requires various KPI's to monitor price changes on a customer / article level, but also to aggregate this on a customer level, or a country level, preferably dynamic as is a strength of Qlik.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Problem description:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Currently I am working on a KPI we call &lt;EM&gt;'Price Increase', &lt;/EM&gt;our management wishes to see this as a single number and allow subsequent drill downs or filters if required. We have discussed at length how we wish to calculate this and was agreed upon based on Excel calculations. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This KPI compares the price in two different time periods (P) and determines a delta. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Price is determined by dividing revenue by quantity for a period therefore requiring entries in both periods for quantity and revenue. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We wish to exclude rows with&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;No revenue for either period&lt;/LI&gt;&lt;LI&gt;No quantity for either period&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Negative entries, e.g. a quantity of '-1' we would like to keep.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Our simplified dataset looks like this. As you can see there a entries with no data, for example the revenue for BillingID 10005. There are other columns, e.g. country but they are not relevant for this quesiton. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="example2.png" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/193913_example2.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If we create a pivot of the data above we can easily highlight rows that should be excluded from this pricing analysis as there is only a price for a single period. A pivot allows us to see issues cropping up.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Example.png" class="jive-image image-3" height="134" src="https://community.qlik.com/legacyfs/online/193914_Example.png" style="height: 133.338px; width: 695px;" width="695" /&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Row 2 - no entry for 2017 for Customer X and Material 2 (visa versa can also occur, only data for 2017 and none for 2016)&lt;/LI&gt;&lt;LI&gt;Row 3 - sum of quantiy is 0 (sum of total revenue can also be 0) &lt;/LI&gt;&lt;LI&gt;Row 4 - No entry for revenue (e.g. free samples)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We wish to exclude these rows. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To further complicate matters the yellow fields can either be:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Null values - there is no entry for that period within the dataset, for example Row 2 - Revenue (2017)&lt;/LI&gt;&lt;LI&gt;The total is 0 for a period, e.g. two billing lines with +1 and -1 (row 3)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is &lt;SPAN style="text-decoration: underline;"&gt;how to calculate the orange cell within Qlik.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My solution direction so far has been failed set analysis as I am unsure how to do two conditions at the same time as I have to look at the corresponding Customer/Article combination in a different time period. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anybody shed some light on this conundrum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;N~ &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-sum-based-on-values-in-different-time-period/m-p/51906#M787855</guid>
      <dc:creator>negidius</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to sum based on values in different time period</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-sum-based-on-values-in-different-time-period/m-p/51907#M787856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This seems to be for a chart, right? Why not check with an if statement to remove those rows which are have 0 or null&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If(Len(Trim(Expression1)) = 0 or Expression1 = 0 (Len(Trim(Expression2)) = 0 or Expression2 = 0), Expression1)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG&gt;If(Len(Trim(Expression1)) = 0 or Expression1 = 0 (Len(Trim(Expression2)) = 0 or Expression2 = 0), Expression2)&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Feb 2018 17:17:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-sum-based-on-values-in-different-time-period/m-p/51907#M787856</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-02-20T17:17:41Z</dc:date>
    </item>
  </channel>
</rss>

