<?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: Using Set Expression with Conditional IF Function in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Using-Set-Expression-with-Conditional-IF-Function/m-p/1643370#M47977</link>
    <description>Assuming each ticket has a unique identifier, TicketID&lt;BR /&gt;SUM(${&amp;lt;TicketID={"=month&amp;gt;=date#('2019-01','yyyy-mm') and month &amp;lt;= date#('2019-08','yyyy-mm')"}&amp;gt;} number_tickets*ticket_value)) / SUM(TOTAL &amp;lt;department_name, team_name&amp;gt; purchases)&lt;BR /&gt;basically stick with Set Analysis, mixing with IF gets confusing IMHO&lt;BR /&gt;Note that date comparisons can be tricky due to the dual nature of dates (number, string display); i've had the best luck explicitly converting to a number in Set Analysis&lt;BR /&gt;Could also try:&lt;BR /&gt;SUM(${&amp;lt;{month=("&amp;gt;=date#('2019-01','yyyy-mm') &amp;lt;= date#('2019-08','yyyy-mm')"}&amp;gt;} number_tickets*ticket_value)) / SUM(TOTAL &amp;lt;department_name, team_name&amp;gt; purchases)&lt;BR /&gt;</description>
    <pubDate>Tue, 05 Nov 2019 18:12:34 GMT</pubDate>
    <dc:creator>dwforest</dc:creator>
    <dc:date>2019-11-05T18:12:34Z</dc:date>
    <item>
      <title>Using Set Expression with Conditional IF Function</title>
      <link>https://community.qlik.com/t5/App-Development/Using-Set-Expression-with-Conditional-IF-Function/m-p/1643302#M47974</link>
      <description>&lt;P&gt;Hey everyone,&lt;/P&gt;&lt;P&gt;I'm pretty new to Qliksense and have been struggling with the Set Expression Formula for some time now.&lt;/P&gt;&lt;P&gt;Right now I'm working on an app that contains information about tickets coming into customer service (across 3 Dimensions: Month, Market &amp;amp; Channel) that are allocated to specific Groups (2 Dimensions: Department &amp;amp; Team) within the company. On the other hand, the app also contains information about overall purchases (also split on the 3 Dimensions:&amp;nbsp;Month, Market &amp;amp; Channel). I have now compiled a Metric that gives me the number of tickets per purchases on the basis of the 3 Dimensions:&amp;nbsp;Month, Market &amp;amp; Channel) as well as the same Metric for the Number of Tickets per Purchase allocated to specific Departments/Teams.&lt;/P&gt;&lt;P&gt;This is now where I'm running into a couple of issues: I have been using the following formula to calculate this share for the respective Departments &amp;amp; Teams (ignoring the department/team split in the purchase data as it does not factor into the purchases and should be ignored) which has worked well:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SUM(number_tickets*ticket_value) / SUM(TOTAL &amp;lt;department_name , team_name&amp;gt; purchases)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Now I would also like to factor in a conditional IF Statement however to account for the fact that only a specific time-frame should be considered in the calculation (the ticket &amp;amp; purchase data have slightly miss-matching time frames which I believe all get summed up regardless when using the "Total" indicator). I cannot figure out however how to combine the IF statement within the Set Expression Function that should calculate the purchase data which is why I am using this half-done formula at the moment and was hoping to get input from others about how to account for the same time frame in the denominator of this function:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SUM(IF(month&amp;gt;='2019-01' AND month &amp;lt;= '2019-086, number_tickets*ticket_value)) / &lt;EM&gt;&lt;FONT color="#FF0000"&gt;SUM(TOTAL &amp;lt;department_name, team_name&amp;gt; purchases)&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;BR /&gt;Best,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 19:45:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-Set-Expression-with-Conditional-IF-Function/m-p/1643302#M47974</guid>
      <dc:creator>Schdeve</dc:creator>
      <dc:date>2024-11-16T19:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: Using Set Expression with Conditional IF Function</title>
      <link>https://community.qlik.com/t5/App-Development/Using-Set-Expression-with-Conditional-IF-Function/m-p/1643370#M47977</link>
      <description>Assuming each ticket has a unique identifier, TicketID&lt;BR /&gt;SUM(${&amp;lt;TicketID={"=month&amp;gt;=date#('2019-01','yyyy-mm') and month &amp;lt;= date#('2019-08','yyyy-mm')"}&amp;gt;} number_tickets*ticket_value)) / SUM(TOTAL &amp;lt;department_name, team_name&amp;gt; purchases)&lt;BR /&gt;basically stick with Set Analysis, mixing with IF gets confusing IMHO&lt;BR /&gt;Note that date comparisons can be tricky due to the dual nature of dates (number, string display); i've had the best luck explicitly converting to a number in Set Analysis&lt;BR /&gt;Could also try:&lt;BR /&gt;SUM(${&amp;lt;{month=("&amp;gt;=date#('2019-01','yyyy-mm') &amp;lt;= date#('2019-08','yyyy-mm')"}&amp;gt;} number_tickets*ticket_value)) / SUM(TOTAL &amp;lt;department_name, team_name&amp;gt; purchases)&lt;BR /&gt;</description>
      <pubDate>Tue, 05 Nov 2019 18:12:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-Set-Expression-with-Conditional-IF-Function/m-p/1643370#M47977</guid>
      <dc:creator>dwforest</dc:creator>
      <dc:date>2019-11-05T18:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: Using Set Expression with Conditional IF Function</title>
      <link>https://community.qlik.com/t5/App-Development/Using-Set-Expression-with-Conditional-IF-Function/m-p/1643733#M48011</link>
      <description>&lt;P&gt;Hey, this sounds really good already - thanks for your input! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The issue however is that the tickets don't have a unique id but are just summed up across the different categories (of issues) that they fall into - is there any way to do it regardless of this or would it be best to add an additional column with a TicketID instead somehow?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2019 12:18:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-Set-Expression-with-Conditional-IF-Function/m-p/1643733#M48011</guid>
      <dc:creator>Schdeve</dc:creator>
      <dc:date>2019-11-06T12:18:28Z</dc:date>
    </item>
  </channel>
</rss>

