<?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>Question Re: IF statement help in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/if-statement-help/qaa-p/12577331#M4716384</link>
    <description>&lt;P&gt;It is always helpful if you can provide some usable sample data. I took your screenshot, typed the data into Excel, &lt;A href="https://www.convertcsv.com/csv-to-sql.htm" target="_blank"&gt;converted it to SQL&lt;/A&gt;, and generated this &lt;A href="https://dbfiddle.uk/jWxsZzv7" target="_blank"&gt;SQL code&lt;/A&gt; which I could then drop into a free-hand SQL query. Now am ready to go with the data you provided.&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2100529-image.png" /&gt;&lt;/P&gt;&lt;P&gt;In order to do this you need to use a &lt;A href="https://michaelwelter.wordpress.com/2011/07/31/removing-the-confusion-from-calculation-contexts/" target="_blank"&gt;calculation context&lt;/A&gt;. By default "the calculation takes place in the context of where it appears on the report.&lt;/P&gt;&lt;P&gt;My approach is to create variable called &lt;B&gt;Var Status Count Per Material Number&lt;/B&gt; to count the unique status values for a Material number defined as...&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;=Count([Status]) In ([Material number])&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This allows me to take into account the status values of other rows that also have the same Material number.&lt;/P&gt;&lt;P&gt;Now we can create the &lt;STRONG&gt;Var Appropriateness&lt;/STRONG&gt; variable...&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;=If([Var Status Count Per Material Number] &amp;gt; 1; "Not OK"; "OK")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2100532-image.png" /&gt;&lt;/P&gt;&lt;P&gt;You can remove Var Status Count Per Material Number. I only have it in the table to show what is happening. You can also do some conditional formatting if you want to turn Var Appropriateness red or green depending on its value.&lt;/P&gt;&lt;P&gt;Note that you will also get "OK" if all the statuses for a give Material number are the same even if they are not "D". You did not seem to be looking for that so I did not provide a solution for that. If you do need that functionality, the variables will need adjustments or perhaps a different method entirely will need to be pursued.&lt;/P&gt;&lt;P&gt;Noel&lt;/P&gt;</description>
    <pubDate>Fri, 23 Sep 2022 18:36:38 GMT</pubDate>
    <dc:creator>nscheaffer</dc:creator>
    <dc:date>2022-09-23T18:36:38Z</dc:date>
    <item>
      <title>IF statement help</title>
      <link>https://community.sap.com/t5/technology-q-a/if-statement-help/qaq-p/12577329</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
  &lt;P&gt;I am new to Business Objects. I am trying to construct a statement in Webi but I am having difficulty with the syntax.&lt;/P&gt;
  &lt;P&gt;In my report I have a tabel with 3 columns, : [Material numberg], [Status], [Version]&lt;/P&gt;
  &lt;P&gt;I want a statement that will give me the result in new column [Appropriateness] say like: If the [Material number] is the same and it has the [Staus] E and D return "NOT OK" and&lt;/P&gt;
  &lt;P&gt;If the Material number is the same and it has only the [Staus] D then return "OK"&lt;/P&gt;
  &lt;P&gt;It also has to had all versions which match apropriate status&lt;/P&gt;
  &lt;P&gt;Here is the table how i would like to be ia result n the last column &lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2098508-image.png" /&gt;&lt;/P&gt;
  &lt;P&gt;Can anyone assist with how this should be written as a variable?&lt;/P&gt;
  &lt;P&gt; I got something like this and its not giving me the right answer:&lt;/P&gt;
  &lt;P&gt;=If ([Material number] = [Material number] Where ([Status] = "E" Or [Status] ="D");"NOT OK";"OK")&lt;/P&gt;
  &lt;P&gt;Many thanks&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 13:40:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/if-statement-help/qaq-p/12577329</guid>
      <dc:creator>former_member1139046</dc:creator>
      <dc:date>2022-09-23T13:40:17Z</dc:date>
    </item>
    <item>
      <title>Re: IF statement help</title>
      <link>https://community.sap.com/t5/technology-q-a/if-statement-help/qaa-p/12577330#M4716383</link>
      <description>&lt;P&gt;Thank you for visiting SAP Community to get answers to your questions. Since you're asking a question here for the first time, I recommend that you familiarize yourself with: &lt;A href="https://community.sap.com/resources/questions-and-answers" target="test_blank"&gt;https://community.sap.com/resources/questions-and-answers&lt;/A&gt;, as it provides tips for preparing questions that draw responses from our members. &lt;/P&gt;&lt;P&gt;For example, you can:&lt;/P&gt;&lt;P&gt;- outline what steps you took to find answers (and why they weren't helpful)&lt;/P&gt;&lt;P&gt;- share screenshots of what you've seen/done&lt;/P&gt;&lt;P&gt;- make sure you've applied the appropriate tags&lt;/P&gt;&lt;P&gt;- use a more descriptive subject line&lt;/P&gt;&lt;P&gt;The more details you provide, the more likely it is that members will be able to respond. Feel free to also take our Q&amp;amp;A  tutorial at: &lt;A href="https://developers.sap.com/tutorials/community-qa.html" target="test_blank"&gt;https://developers.sap.com/tutorials/community-qa.html&lt;/A&gt;      &lt;/P&gt;&lt;P&gt; Should you wish, you can revise your question by selecting Actions, then Edit.&lt;/P&gt;&lt;P&gt;  By adding a picture to your profile you encourage readers to respond: &lt;A href="https://developers.sap.com/tutorials/community-profile.html" target="test_blank"&gt;https://developers.sap.com/tutorials/community-profile.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 13:40:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/if-statement-help/qaa-p/12577330#M4716383</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2022-09-23T13:40:45Z</dc:date>
    </item>
    <item>
      <title>Re: IF statement help</title>
      <link>https://community.sap.com/t5/technology-q-a/if-statement-help/qaa-p/12577331#M4716384</link>
      <description>&lt;P&gt;It is always helpful if you can provide some usable sample data. I took your screenshot, typed the data into Excel, &lt;A href="https://www.convertcsv.com/csv-to-sql.htm" target="_blank"&gt;converted it to SQL&lt;/A&gt;, and generated this &lt;A href="https://dbfiddle.uk/jWxsZzv7" target="_blank"&gt;SQL code&lt;/A&gt; which I could then drop into a free-hand SQL query. Now am ready to go with the data you provided.&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2100529-image.png" /&gt;&lt;/P&gt;&lt;P&gt;In order to do this you need to use a &lt;A href="https://michaelwelter.wordpress.com/2011/07/31/removing-the-confusion-from-calculation-contexts/" target="_blank"&gt;calculation context&lt;/A&gt;. By default "the calculation takes place in the context of where it appears on the report.&lt;/P&gt;&lt;P&gt;My approach is to create variable called &lt;B&gt;Var Status Count Per Material Number&lt;/B&gt; to count the unique status values for a Material number defined as...&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;=Count([Status]) In ([Material number])&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This allows me to take into account the status values of other rows that also have the same Material number.&lt;/P&gt;&lt;P&gt;Now we can create the &lt;STRONG&gt;Var Appropriateness&lt;/STRONG&gt; variable...&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;=If([Var Status Count Per Material Number] &amp;gt; 1; "Not OK"; "OK")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2100532-image.png" /&gt;&lt;/P&gt;&lt;P&gt;You can remove Var Status Count Per Material Number. I only have it in the table to show what is happening. You can also do some conditional formatting if you want to turn Var Appropriateness red or green depending on its value.&lt;/P&gt;&lt;P&gt;Note that you will also get "OK" if all the statuses for a give Material number are the same even if they are not "D". You did not seem to be looking for that so I did not provide a solution for that. If you do need that functionality, the variables will need adjustments or perhaps a different method entirely will need to be pursued.&lt;/P&gt;&lt;P&gt;Noel&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 18:36:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/if-statement-help/qaa-p/12577331#M4716384</guid>
      <dc:creator>nscheaffer</dc:creator>
      <dc:date>2022-09-23T18:36:38Z</dc:date>
    </item>
  </channel>
</rss>

