<?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: can you help me with two complex queries? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/can-you-help-me-with-two-complex-queries/m-p/599276#M479464</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually, it works. But you should specify, which field&amp;nbsp; you want to use as aggregation.&lt;/P&gt;&lt;P&gt;Try the third expression as a calculated dimension.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Feb 2014 18:48:35 GMT</pubDate>
    <dc:creator>whiteline</dc:creator>
    <dc:date>2014-02-03T18:48:35Z</dc:date>
    <item>
      <title>can you help me with two complex queries?</title>
      <link>https://community.qlik.com/t5/QlikView/can-you-help-me-with-two-complex-queries/m-p/599273#M479461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can you help me with two complex queries? (complex at least to me).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the problem (simplified, but this is more or less database I have):&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Invoice_header:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Load * INLINE&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;[&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Invoice_ID, Name, Total_amount&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1,&amp;nbsp;&amp;nbsp; Zeus, 1000,&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2,&amp;nbsp;&amp;nbsp; Thor,&amp;nbsp; 1500,&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3,&amp;nbsp;&amp;nbsp; Venus, 2700,&amp;nbsp;&amp;nbsp; ];&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Invoice_items:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;Load * INLINE&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;[&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Invoice_ID, item_name, Item_price, Item_color, Item_list_price&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1,&amp;nbsp;&amp;nbsp; wheel, 500, black, 550&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1,&amp;nbsp;&amp;nbsp; seat, 500, black, 550&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2,&amp;nbsp;&amp;nbsp; chain, 700, black, 700 &lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2,&amp;nbsp;&amp;nbsp; tire, 800, white,&amp;nbsp; 800 ];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to make two queries which will help me find following:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I want to find all invoices where we have mismatch between item colors; idea is to find all invoices which were issued but they have different color defined for items); rule is that all items should have same color (color is not defined in invoice header, although I see that I can find a way to define correct color for each invoice)&lt;/LI&gt;&lt;LI&gt;I want to find a way to find all invoices where total amount in header is not the same like sum of items list price (I was thinking of creating running totals of items list price somehow but failed to find a proper way)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is not actual database structure but I can derive data in this way (this structure is derived from multiple databases).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas, pointers?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p.s. I know this is not a standard query or even a situation which should happen in the first place, but what I am trying to do is to find if the database was tampered with and I have to reconstruct results and compare it with what was supposed to happen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Feb 2014 09:01:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/can-you-help-me-with-two-complex-queries/m-p/599273#M479461</guid>
      <dc:creator>marko_rakar</dc:creator>
      <dc:date>2014-02-03T09:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: can you help me with two complex queries?</title>
      <link>https://community.qlik.com/t5/QlikView/can-you-help-me-with-two-complex-queries/m-p/599274#M479462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a chart with Invoice_ID as dimension.&lt;/P&gt;&lt;P&gt;This expression gives you only those having more than one color:&lt;/P&gt;&lt;P&gt;=Count&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;DISTINCT&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Item_color&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)&amp;gt;1 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;This expression gives you only those having total differ from items:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;=Sum(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Item_price&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)&amp;lt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Total_amount &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the same approach and add list boxes with expressions that allow user to select such Invoices.&lt;/P&gt;&lt;P&gt;=aggr(Count&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;DISTINCT&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Item_color&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)&amp;gt;1 &lt;/SPAN&gt;, Invoice_ID)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Feb 2014 09:51:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/can-you-help-me-with-two-complex-queries/m-p/599274#M479462</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2014-02-03T09:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: can you help me with two complex queries?</title>
      <link>https://community.qlik.com/t5/QlikView/can-you-help-me-with-two-complex-queries/m-p/599275#M479463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;quite simple (and when I look at that now, quite obvious) solution&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it works like a charm, now I have to test it on much more complex formulas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but, can someone tell me why this formula works as expression and not as calculated dimension? (it should behave the same, or at least that is what I understand)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Feb 2014 12:21:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/can-you-help-me-with-two-complex-queries/m-p/599275#M479463</guid>
      <dc:creator>marko_rakar</dc:creator>
      <dc:date>2014-02-03T12:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: can you help me with two complex queries?</title>
      <link>https://community.qlik.com/t5/QlikView/can-you-help-me-with-two-complex-queries/m-p/599276#M479464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually, it works. But you should specify, which field&amp;nbsp; you want to use as aggregation.&lt;/P&gt;&lt;P&gt;Try the third expression as a calculated dimension.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Feb 2014 18:48:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/can-you-help-me-with-two-complex-queries/m-p/599276#M479464</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2014-02-03T18:48:35Z</dc:date>
    </item>
  </channel>
</rss>

