<?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: Compare a value from a table to another value from another table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Compare-a-value-from-a-table-to-another-value-from-another-table/m-p/1532467#M746869</link>
    <description>Great solution.&lt;BR /&gt;&lt;BR /&gt;I have a question, how can I solve the query&lt;BR /&gt;Using the for loop and the peek function !!</description>
    <pubDate>Sun, 20 Jan 2019 17:15:50 GMT</pubDate>
    <dc:creator>maohob1</dc:creator>
    <dc:date>2019-01-20T17:15:50Z</dc:date>
    <item>
      <title>Compare a value from a table to another value from another table</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-a-value-from-a-table-to-another-value-from-another-table/m-p/1532453#M746867</link>
      <description>&lt;P&gt;Hello all&lt;BR /&gt;I am a new user of qlik products&lt;/P&gt;&lt;P&gt;I have a question&lt;BR /&gt;I have two tables ( '&lt;SPAN&gt;StudentTable' and 'GradeTable')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I set up a third table called 'CalculationGradeTable'&lt;/P&gt;&lt;P&gt;Calculates the student's score(&lt;SPAN&gt;SetMark)&lt;/SPAN&gt;&lt;BR /&gt;Example :&lt;BR /&gt;If the student takes the grade of 40, he supposed to have a 'Poor' rating&amp;nbsp;&amp;nbsp;Dependence on 'MinGrade, MaxGrade' field&lt;BR /&gt;If the student takes the grade of 88 he should have a 'very good' rating&amp;nbsp;&lt;SPAN&gt;Dependence on 'MinGrade, MaxGrade' field&lt;/SPAN&gt;&lt;BR /&gt;The valuation should be calculated with the 'SetMark' column&lt;/P&gt;&lt;P&gt;How to do it !!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// My Code ....&lt;/P&gt;&lt;P&gt;StudentTable:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;IDStd,NameStd,GradeStd&lt;BR /&gt;1,'A',40&lt;BR /&gt;2,'B',85&lt;BR /&gt;3,'C',75&lt;BR /&gt;4,'D',45&lt;BR /&gt;5,'E',3&lt;BR /&gt;6,'F',100&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;GradeTable:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;MinGrade, MaxGrade,Mark&lt;BR /&gt;0, 59 , 'Poor'&lt;BR /&gt;60, 75,'good'&lt;BR /&gt;76, 89,'very good'&lt;BR /&gt;90, 100,'Excellent'&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;CalculationGradeTable:&lt;BR /&gt;LOAD&lt;BR /&gt;IDStd as ID ,&lt;BR /&gt;NameStd as Name ,&lt;BR /&gt;IF( GradeStd &amp;gt;= Peek('MinGrade',0,'GradeTable') and&lt;BR /&gt;GradeStd &amp;lt;=Peek('MaxGrade',0,'GradeTable')&lt;BR /&gt;, Peek('Mark',0 ,'GradeTable'),&lt;BR /&gt;IF( GradeStd &amp;gt;= Peek('MinGrade',1,'GradeTable') and&lt;BR /&gt;GradeStd &amp;lt;=Peek('MaxGrade',1,'GradeTable')&lt;BR /&gt;, Peek('Mark',1 ,'GradeTable'),&lt;BR /&gt;IF( GradeStd &amp;gt;= Peek('MinGrade',2,'GradeTable') and&lt;BR /&gt;GradeStd &amp;lt;=Peek('MaxGrade',2,'GradeTable')&lt;BR /&gt;, Peek('Mark',2 ,'GradeTable'),&lt;BR /&gt;IF( GradeStd &amp;gt;= Peek('MinGrade',3,'GradeTable') and&lt;BR /&gt;GradeStd &amp;lt;=Peek('MaxGrade',3,'GradeTable')&lt;BR /&gt;, Peek('Mark',3 ,'GradeTable')&lt;BR /&gt;&lt;BR /&gt;)))) as SetMark&lt;BR /&gt;Resident StudentTable&lt;BR /&gt;Order By GradeStd desc ;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-a-value-from-a-table-to-another-value-from-another-table/m-p/1532453#M746867</guid>
      <dc:creator>maohob1</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Compare a value from a table to another value from another table</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-a-value-from-a-table-to-another-value-from-another-table/m-p/1532455#M746868</link>
      <description>&lt;P&gt;Maybe try like this:&lt;/P&gt;&lt;PRE&gt;StudentTable:
LOAD * INLINE [
IDStd,NameStd,GradeStd
1,'A',40
2,'B',85
3,'C',75
4,'D',45
5,'E',3
6,'F',100
];


GradeTable:
LOAD * INLINE [
MinGrade, MaxGrade,Mark
0, 59 , 'Poor'
60, 75,'good'
76, 89,'very good'
90, 100,'Excellent'
];

left Join

IntervalMatch(GradeStd)
Final:
LOAD MinGrade,MaxGrade Resident GradeTable;&lt;/PRE&gt;</description>
      <pubDate>Sun, 20 Jan 2019 13:08:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-a-value-from-a-table-to-another-value-from-another-table/m-p/1532455#M746868</guid>
      <dc:creator>Frank_Hartmann</dc:creator>
      <dc:date>2019-01-20T13:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: Compare a value from a table to another value from another table</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-a-value-from-a-table-to-another-value-from-another-table/m-p/1532467#M746869</link>
      <description>Great solution.&lt;BR /&gt;&lt;BR /&gt;I have a question, how can I solve the query&lt;BR /&gt;Using the for loop and the peek function !!</description>
      <pubDate>Sun, 20 Jan 2019 17:15:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-a-value-from-a-table-to-another-value-from-another-table/m-p/1532467#M746869</guid>
      <dc:creator>maohob1</dc:creator>
      <dc:date>2019-01-20T17:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: Compare a value from a table to another value from another table</title>
      <link>https://community.qlik.com/t5/QlikView/Compare-a-value-from-a-table-to-another-value-from-another-table/m-p/1532501#M746870</link>
      <description>&lt;P&gt;I suggest that you use the intervalmatch solution already posted. That would normally be the correct way to solve your problem. Do you have a specific reason not to use interval matching?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jan 2019 05:30:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Compare-a-value-from-a-table-to-another-value-from-another-table/m-p/1532501#M746870</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2019-01-21T05:30:40Z</dc:date>
    </item>
  </channel>
</rss>

