<?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: Formula to calculate differences from one week count to past week count in Data &amp; Schema Discussions</title>
    <link>https://community.incorta.com/t5/data-schema-discussions/formula-to-calculate-differences-from-one-week-count-to-past/m-p/3136#M219</link>
    <description>&lt;P&gt;Use a formula column at the physical schema to change the clockin date/time into an integer w/ the value of 1 will let you do a sum instead of a count.&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You'll still have the issue, just taking a step to make things easier.&lt;/P&gt;&lt;P&gt;Reference this thread for a similar issue:&amp;nbsp;&amp;nbsp;&lt;A href="https://community.incorta.com/t5/dashboards-analytics-discussions/what-is-a-simple-excel-reference-is-hard-in-incorta/td-p/3051" target="_blank"&gt;https://community.incorta.com/t5/dashboards-analytics-discussions/what-is-a-simple-excel-reference-is-hard-in-incorta/td-p/3051&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 01 Nov 2022 16:51:02 GMT</pubDate>
    <dc:creator>RADSr</dc:creator>
    <dc:date>2022-11-01T16:51:02Z</dc:date>
    <item>
      <title>Formula to calculate differences from one week count to past week count</title>
      <link>https://community.incorta.com/t5/data-schema-discussions/formula-to-calculate-differences-from-one-week-count-to-past/m-p/3022#M213</link>
      <description>&lt;P&gt;If I have an Incorta dashboard as such:&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;date&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; count&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;difference formula&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;10/10/2022&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 (N/A)&lt;/P&gt;&lt;P&gt;10/17/2022&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 28&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;18&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;And I want to see the difference between the count value for date 10/17 and the count value for date 10/10 (week earlier), manually writing this the math is 28 - 10 = 18 (difference)&lt;/P&gt;&lt;P&gt;How would I construct an Incorta Insight formula to calculate that difference in either a listing, aggregate or perhaps pivot table?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 21:06:19 GMT</pubDate>
      <guid>https://community.incorta.com/t5/data-schema-discussions/formula-to-calculate-differences-from-one-week-count-to-past/m-p/3022#M213</guid>
      <dc:creator>Jono</dc:creator>
      <dc:date>2022-10-21T21:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to calculate differences from one week count to past week count</title>
      <link>https://community.incorta.com/t5/data-schema-discussions/formula-to-calculate-differences-from-one-week-count-to-past/m-p/3027#M214</link>
      <description>&lt;P&gt;Jono,&lt;/P&gt;
&lt;P&gt;Are you really summing the "week" or are you picking specific days (value on 17th and 10th),&amp;nbsp; If you look at the syntax for the sum() function in Inclorta, you will see that you have 2 options:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;sum(Sales.Sales.AMOUNT_SOLD)&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV class="inc-function-info__example__description" data-testid="inc-function-info__example__description"&gt;or&lt;/DIV&gt;
&lt;DIV class="inc-function-info__example__description" data-testid="inc-function-info__example__description"&gt;&lt;SPAN&gt;sum(Sales.Sales.UNITS, groupBy(Sales.Product.PRODUCT_CATEGORY))&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class="inc-function-info__example__description" data-testid="inc-function-info__example__description"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="inc-function-info__example__description" data-testid="inc-function-info__example__description"&gt;&lt;SPAN&gt;Therefore, you could sum grouping by the date, and then subtract the sum grouped by the date - 7.&amp;nbsp; and for that part we have a addDays() function.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class="inc-function-info__example__description" data-testid="inc-function-info__example__description"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="inc-function-info__example__description" data-testid="inc-function-info__example__description"&gt;&lt;SPAN&gt;try something like (sum(amount, groupBy(date)) -&amp;nbsp;sum(amount, groupBy(addDays(date,-7))))&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class="inc-function-info__example__description" data-testid="inc-function-info__example__description"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="inc-function-info__example__description" data-testid="inc-function-info__example__description"&gt;&lt;SPAN&gt;Hope that this helps.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class="inc-function-info__example__description" data-testid="inc-function-info__example__description"&gt;&lt;SPAN&gt;Jeff&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 24 Oct 2022 14:52:21 GMT</pubDate>
      <guid>https://community.incorta.com/t5/data-schema-discussions/formula-to-calculate-differences-from-one-week-count-to-past/m-p/3027#M214</guid>
      <dc:creator>JeffW</dc:creator>
      <dc:date>2022-10-24T14:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to calculate differences from one week count to past week count</title>
      <link>https://community.incorta.com/t5/data-schema-discussions/formula-to-calculate-differences-from-one-week-count-to-past/m-p/3132#M217</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.incorta.com/t5/user/viewprofilepage/user-id/208"&gt;@Jono&lt;/a&gt;, Did Jeff's response answer your question?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 15:09:13 GMT</pubDate>
      <guid>https://community.incorta.com/t5/data-schema-discussions/formula-to-calculate-differences-from-one-week-count-to-past/m-p/3132#M217</guid>
      <dc:creator>KailaT</dc:creator>
      <dc:date>2022-11-01T15:09:13Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to calculate differences from one week count to past week count</title>
      <link>https://community.incorta.com/t5/data-schema-discussions/formula-to-calculate-differences-from-one-week-count-to-past/m-p/3134#M218</link>
      <description>&lt;P&gt;Hi Kaila, I'm sorry I didn't respond earlier. I did try what he said, and it didn't work for me. However, the field I'm trying to use as a "measure" is a timestamp field. What I'm trying to do is count the number of times employees clock in on say Tuesday (today) and last Tuesday and then find the difference (through a formula) to show the change in count. I guess his advice didn't work for me because I'm counting using a timestamp field (it does seem to count by the way but doesn't work with the formula he gave me). If that's the problem, is there a way for me to convert the timestamp field into a new measure field and then apply his formula?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 15:53:17 GMT</pubDate>
      <guid>https://community.incorta.com/t5/data-schema-discussions/formula-to-calculate-differences-from-one-week-count-to-past/m-p/3134#M218</guid>
      <dc:creator>Jono</dc:creator>
      <dc:date>2022-11-01T15:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to calculate differences from one week count to past week count</title>
      <link>https://community.incorta.com/t5/data-schema-discussions/formula-to-calculate-differences-from-one-week-count-to-past/m-p/3136#M219</link>
      <description>&lt;P&gt;Use a formula column at the physical schema to change the clockin date/time into an integer w/ the value of 1 will let you do a sum instead of a count.&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You'll still have the issue, just taking a step to make things easier.&lt;/P&gt;&lt;P&gt;Reference this thread for a similar issue:&amp;nbsp;&amp;nbsp;&lt;A href="https://community.incorta.com/t5/dashboards-analytics-discussions/what-is-a-simple-excel-reference-is-hard-in-incorta/td-p/3051" target="_blank"&gt;https://community.incorta.com/t5/dashboards-analytics-discussions/what-is-a-simple-excel-reference-is-hard-in-incorta/td-p/3051&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 16:51:02 GMT</pubDate>
      <guid>https://community.incorta.com/t5/data-schema-discussions/formula-to-calculate-differences-from-one-week-count-to-past/m-p/3136#M219</guid>
      <dc:creator>RADSr</dc:creator>
      <dc:date>2022-11-01T16:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to calculate differences from one week count to past week count</title>
      <link>https://community.incorta.com/t5/data-schema-discussions/formula-to-calculate-differences-from-one-week-count-to-past/m-p/3160#M226</link>
      <description>&lt;P&gt;Thank you to all who gave me hints at a solution. However, kudos to my manager who actually solved the issue for me. The solution involved using Lookup similar to this example below.&lt;/P&gt;&lt;P&gt;lookup(&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; schema_A.table_A.count_field&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; schema_A.table_A.date_field&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;schema_B.table_B.date_field&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;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t;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: for our situation a materialized view (schema_A) was necessary to create a count field because lookup will not work with other functions and so the count function had to be used ahead of time to create a new field with the count already in it; then lookup could work with that field that had the count; also he set up the date field in the materialized view (schema_A) as a key field since lookup function requires a key.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 15:08:59 GMT</pubDate>
      <guid>https://community.incorta.com/t5/data-schema-discussions/formula-to-calculate-differences-from-one-week-count-to-past/m-p/3160#M226</guid>
      <dc:creator>Jono</dc:creator>
      <dc:date>2022-11-04T15:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: Formula to calculate differences from one week count to past week count</title>
      <link>https://community.incorta.com/t5/data-schema-discussions/formula-to-calculate-differences-from-one-week-count-to-past/m-p/3163#M227</link>
      <description>&lt;P&gt;Jeff, a comment on the try suggestion: when I try to do this I get this error:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;INC_04050708: The group by columns in the level based measure should be used in the grouping dimensions and have the same order Date_Time.Date.Date.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;We have found a way to do this using an MV.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2022 19:41:50 GMT</pubDate>
      <guid>https://community.incorta.com/t5/data-schema-discussions/formula-to-calculate-differences-from-one-week-count-to-past/m-p/3163#M227</guid>
      <dc:creator>marcpaige</dc:creator>
      <dc:date>2022-11-04T19:41:50Z</dc:date>
    </item>
  </channel>
</rss>

