<?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 How to calculate the GCD(Greatest Common divisor) in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-calculate-the-GCD-Greatest-Common-divisor/m-p/188908#M51999</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The method is the Euclidean Algorithm and the code is way beyond me. This is a representation of the code in C. Macro guy needed&lt;/P&gt;&lt;P&gt;&lt;A href="http://en.literateprograms.org/Special:Downloadcode/Euclidean_algorithm_%28C%29"&gt;http://en.literateprograms.org/Special:Downloadcode/Euclidean_algorithm_%28C%29&lt;/A&gt;&lt;/P&gt;&lt;P&gt;This is the code breakdown explanation&lt;/P&gt;&lt;P&gt;&lt;A href="http://en.literateprograms.org/Euclidean_algorithm_(C"&gt;http://en.literateprograms.org/Euclidean_algorithm_(C&lt;/A&gt;)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 Nov 2010 11:54:02 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-11-16T11:54:02Z</dc:date>
    <item>
      <title>How to calculate the GCD(Greatest Common divisor)</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-calculate-the-GCD-Greatest-Common-divisor/m-p/188907#M51998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI all&lt;/P&gt;&lt;P&gt;Could any one tell me how to calculate the GCD of the two field values in qlikview..&lt;/P&gt;&lt;P&gt;for ex:&lt;/P&gt;&lt;P&gt;I have field A and B like&lt;/P&gt;&lt;P&gt;A B&lt;/P&gt;&lt;P&gt;10 20&lt;/P&gt;&lt;P&gt;6 9&lt;/P&gt;&lt;P&gt;20 11&lt;/P&gt;&lt;P&gt;the output should be come as like&lt;/P&gt;&lt;P&gt;A B GCD&lt;/P&gt;&lt;P&gt;10 20 10&lt;/P&gt;&lt;P&gt;6 9 3&lt;/P&gt;&lt;P&gt;20 11 1&lt;/P&gt;&lt;P&gt;hope it will give clear understanding&lt;/P&gt;&lt;P&gt;Could anyone help me...&lt;/P&gt;&lt;P&gt;thanks in advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Nov 2010 11:20:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-calculate-the-GCD-Greatest-Common-divisor/m-p/188907#M51998</guid>
      <dc:creator />
      <dc:date>2010-11-16T11:20:25Z</dc:date>
    </item>
    <item>
      <title>How to calculate the GCD(Greatest Common divisor)</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-calculate-the-GCD-Greatest-Common-divisor/m-p/188908#M51999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The method is the Euclidean Algorithm and the code is way beyond me. This is a representation of the code in C. Macro guy needed&lt;/P&gt;&lt;P&gt;&lt;A href="http://en.literateprograms.org/Special:Downloadcode/Euclidean_algorithm_%28C%29"&gt;http://en.literateprograms.org/Special:Downloadcode/Euclidean_algorithm_%28C%29&lt;/A&gt;&lt;/P&gt;&lt;P&gt;This is the code breakdown explanation&lt;/P&gt;&lt;P&gt;&lt;A href="http://en.literateprograms.org/Euclidean_algorithm_(C"&gt;http://en.literateprograms.org/Euclidean_algorithm_(C&lt;/A&gt;)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Nov 2010 11:54:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-calculate-the-GCD-Greatest-Common-divisor/m-p/188908#M51999</guid>
      <dc:creator />
      <dc:date>2010-11-16T11:54:02Z</dc:date>
    </item>
    <item>
      <title>How to calculate the GCD(Greatest Common divisor)</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-calculate-the-GCD-Greatest-Common-divisor/m-p/188909#M52000</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Below is a simplification of the calculation of GCD.&lt;/P&gt;&lt;P&gt;"I'll explain the algorithm with an example. Let's find the gcd of&lt;BR /&gt;210 and 990.&lt;BR /&gt;&lt;BR /&gt;Divide 990 by 210: quotient 4, remainder 150; ignore quotient&lt;BR /&gt;Divide divisor from previous step by remainder from previous step&lt;BR /&gt; divide 210 by 150: quotient 1, remainder 60; ignore quotient&lt;BR /&gt;Divide divisor from previous step by remainder from previous step&lt;BR /&gt; divide 150 by 60: quotient 2, remainder 30; ignore quotient&lt;BR /&gt;Divide divisor from previous step by remainder from previous step&lt;BR /&gt; divide 60 by 30: quotient 2, remainder 0.&lt;BR /&gt;&lt;BR /&gt;When the remainder becomes 0, as it always will, then go to the&lt;BR /&gt;previous step and choose the remainder, in this case 30. This is the&lt;BR /&gt;gcd! Neat!"&lt;/P&gt;&lt;P&gt;Using MOD(x1,x2) is probably the way to go with this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Nov 2010 13:51:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-calculate-the-GCD-Greatest-Common-divisor/m-p/188909#M52000</guid>
      <dc:creator />
      <dc:date>2010-11-16T13:51:25Z</dc:date>
    </item>
    <item>
      <title>How to calculate the GCD(Greatest Common divisor)</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-calculate-the-GCD-Greatest-Common-divisor/m-p/188910#M52001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, taking the idea from here &lt;A href="http://en.wikipedia.org/wiki/Euclidean_algorithm" target="_blank"&gt;http://en.wikipedia.org/wiki/Euclidean_algorithm&lt;/A&gt; i've made this&lt;/P&gt;&lt;P&gt;1st: Create a Function in the macro editor&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;function gcd(a, b)&lt;BR /&gt; while b &amp;lt;&amp;gt; 0&lt;BR /&gt; t = b&lt;BR /&gt; b = a mod b&lt;BR /&gt; a = t&lt;BR /&gt; wend&lt;BR /&gt; gcd = a&lt;BR /&gt;end function&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;then, use it in the script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;DATA:&lt;BR /&gt;LOAD&lt;BR /&gt; F1,&lt;BR /&gt; F2,&lt;BR /&gt; gcd(F1,F2) as GCD&lt;BR /&gt;INLINE [&lt;BR /&gt; F1, F2&lt;BR /&gt; 10,20&lt;BR /&gt; 6, 9&lt;BR /&gt; 20,11&lt;BR /&gt; 4,3&lt;BR /&gt;];&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;And the result is&lt;/P&gt;&lt;P&gt;F1 F2 GCD&lt;BR /&gt;10 20 10&lt;BR /&gt;6 9 3&lt;BR /&gt;4 3 1&lt;BR /&gt;20 11 1&lt;BR /&gt;4 2 2&lt;BR /&gt;&lt;BR /&gt;Rgds&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Nov 2010 14:03:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-calculate-the-GCD-Greatest-Common-divisor/m-p/188910#M52001</guid>
      <dc:creator>hector</dc:creator>
      <dc:date>2010-11-16T14:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate the GCD(Greatest Common divisor)</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-calculate-the-GCD-Greatest-Common-divisor/m-p/188911#M52002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a different datamodel where columns are shown as rows (attached).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to calculate the GCD based on this model ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to show the ratio between Designers vs Layout and vice-versa. In order to get the ratio, we need to get the GCD first.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="415"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl66" height="17" width="205"&gt;Project&lt;/TD&gt;&lt;TD class="xl66" style="border-left: medium none;" width="70"&gt;Skills&lt;/TD&gt;&lt;TD class="xl70" width="70"&gt;Month&lt;/TD&gt;&lt;TD class="xl70" width="70"&gt;Headcount&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" style="border-top: medium none;"&gt;ProjectA&lt;/TD&gt;&lt;TD class="xl67" style="border-left: medium none; border-top: medium none;"&gt;Designers&lt;/TD&gt;&lt;TD align="right" class="xl71"&gt;1-Oct-11&lt;/TD&gt;&lt;TD align="right" class="xl68"&gt;6.25&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" style="border-top: medium none;"&gt;ProjectA&lt;/TD&gt;&lt;TD class="xl67" style="border-left: medium none; border-top: medium none;"&gt;Layout&lt;/TD&gt;&lt;TD align="right" class="xl71" style="border-top: medium none;"&gt;1-Oct-11&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: medium none;"&gt;0.50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" style="border-top: medium none;"&gt;ProjectB&lt;/TD&gt;&lt;TD class="xl67" style="border-left: medium none; border-top: medium none;"&gt;Designers&lt;/TD&gt;&lt;TD align="right" class="xl72"&gt;1-Nov-11&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: medium none;"&gt;5.50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD class="xl69" height="17"&gt;ProjectB&lt;/TD&gt;&lt;TD class="xl67" style="border-top: medium none;"&gt;Layout&lt;/TD&gt;&lt;TD align="right" class="xl72"&gt;1-Nov-11&lt;/TD&gt;&lt;TD align="right" class="xl68" style="border-top: medium none;"&gt;1.50&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2012 00:27:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-calculate-the-GCD-Greatest-Common-divisor/m-p/188911#M52002</guid>
      <dc:creator />
      <dc:date>2012-01-10T00:27:16Z</dc:date>
    </item>
    <item>
      <title>How to calculate the GCD(Greatest Common divisor)</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-calculate-the-GCD-Greatest-Common-divisor/m-p/188912#M52003</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi Anthony,&lt;/P&gt;&lt;P&gt;You can do this. But for this you need to get designers and Layout as columns. Please load table with where clause Skills =Designers and name headcount as Designer Headcount and then Join it with same table on where clause Skills= Layout and Head count as Layout Headcount on Primary key (May be Project and Month) and use the above defined function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;VIjay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2012 05:32:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-calculate-the-GCD-Greatest-Common-divisor/m-p/188912#M52003</guid>
      <dc:creator>vijay_iitkgp</dc:creator>
      <dc:date>2012-01-10T05:32:24Z</dc:date>
    </item>
  </channel>
</rss>

