<?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: Set analysis with multiple conditions in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Set-analysis-with-multiple-conditions/m-p/1636503#M47411</link>
    <description>&lt;P&gt;&lt;SPAN&gt;- "Condition a"&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;and&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;"Condition b" is equal&amp;nbsp; &lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Oct 2019 08:20:15 GMT</pubDate>
    <dc:creator>almosthuman</dc:creator>
    <dc:date>2019-10-17T08:20:15Z</dc:date>
    <item>
      <title>Set analysis with multiple conditions</title>
      <link>https://community.qlik.com/t5/App-Development/Set-analysis-with-multiple-conditions/m-p/1636499#M47410</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Hi all,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;this is my base table:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="BV8TYwV.png" style="width: 307px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/21767i8985708A6709D5EC/image-size/large?v=v2&amp;amp;px=999" role="button" title="BV8TYwV.png" alt="BV8TYwV.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to count only entries where:&lt;/P&gt;&lt;P&gt;- "Date a" is smaller than "Date b"&amp;nbsp;&lt;BR /&gt;- "Condition a" &lt;STRONG&gt;and&lt;/STRONG&gt; "Condition b" is equal&amp;nbsp; "1"&lt;BR /&gt;- "Date a" is from 2019.&lt;/P&gt;&lt;P&gt;Therefore the result should be equal 2.&lt;/P&gt;&lt;P&gt;I tried this:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Count({$&amp;lt;[Date a] ={"=month(date([Date a]))='*' and num(year([Data a]))=2019"}, //only from 2019&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;[Date a] ={"=date([Date a]) &amp;lt; date([Date b])"}, //only where "Date a" is smaller than "Date b"&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;[Condition a] -= {0}, //exclude 0&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;[Condition b] -= {0},&amp;nbsp; //exclude 0&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;gt;}[Date a]&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;But it won't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas? Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 19:53:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-analysis-with-multiple-conditions/m-p/1636499#M47410</guid>
      <dc:creator>almosthuman</dc:creator>
      <dc:date>2024-11-16T19:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis with multiple conditions</title>
      <link>https://community.qlik.com/t5/App-Development/Set-analysis-with-multiple-conditions/m-p/1636503#M47411</link>
      <description>&lt;P&gt;&lt;SPAN&gt;- "Condition a"&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;and&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;"Condition b" is equal&amp;nbsp; &lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2019 08:20:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-analysis-with-multiple-conditions/m-p/1636503#M47411</guid>
      <dc:creator>almosthuman</dc:creator>
      <dc:date>2019-10-17T08:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis with multiple conditions</title>
      <link>https://community.qlik.com/t5/App-Development/Set-analysis-with-multiple-conditions/m-p/1636523#M47414</link>
      <description>&lt;P&gt;Maybe something like this:&lt;/P&gt;&lt;P&gt;script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;LOAD * INLINE [
    Condition_a, Condition_b, Date_a, Date_b
    1, 1, 12.01.2019, 30.01.2019
    1, 0, 12.05.2019, 12.05.2019
    0, 1, 15.03.2019, 15.03.2019
    1, 1, 28.06.2018, 15.05.2019
    1, 1, 05.05.2019, tbd
    1, 1, 01.03.2019
    1, 1, 09.10.2019, 25.05.2020
];&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;textbox:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;=count({&amp;lt;Date_b={"=Date_a &amp;lt; Date_b and Condition_a = 1 and  Condition_b =1 and year(Date_a) = 2019 and Date_b &amp;lt;&amp;gt; 'tbd' and Date_b &amp;lt;&amp;gt; Null()"}&amp;gt;}Date_a)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2019 08:47:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-analysis-with-multiple-conditions/m-p/1636523#M47414</guid>
      <dc:creator>Frank_Hartmann</dc:creator>
      <dc:date>2019-10-17T08:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis with multiple conditions</title>
      <link>https://community.qlik.com/t5/App-Development/Set-analysis-with-multiple-conditions/m-p/1636590#M47421</link>
      <description>Thank you, Frank, but unfortunately the result is not 2.</description>
      <pubDate>Thu, 17 Oct 2019 10:22:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-analysis-with-multiple-conditions/m-p/1636590#M47421</guid>
      <dc:creator>almosthuman</dc:creator>
      <dc:date>2019-10-17T10:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis with multiple conditions</title>
      <link>https://community.qlik.com/t5/App-Development/Set-analysis-with-multiple-conditions/m-p/1636610#M47423</link>
      <description>&lt;P&gt;2 solutions:&lt;/P&gt;&lt;P&gt;1st :&amp;nbsp;count( {&amp;lt;Condition_a={1},Condition_b={1},[Date_a]={"=Date_a.autoCalendar.Date &amp;lt; Date_b.autoCalendar.Date"},[Date_a.autoCalendar.Year]={'2019'} &amp;gt;} Date_a)&lt;/P&gt;&lt;P&gt;2nd:&amp;nbsp;&lt;/P&gt;&lt;P&gt;sum(if(Condition_a = 1 and Condition_b = 1 and Date_a &amp;lt; Date_b and year(Date_a)=2019 , 1, 0))&lt;/P&gt;&lt;P&gt;Just make sure Date_a and Date_b is loaded as Date. I tried and get same value (2) with both solutions&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2019 10:54:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-analysis-with-multiple-conditions/m-p/1636610#M47423</guid>
      <dc:creator>thi_pham</dc:creator>
      <dc:date>2019-10-17T10:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis with multiple conditions</title>
      <link>https://community.qlik.com/t5/App-Development/Set-analysis-with-multiple-conditions/m-p/1636613#M47424</link>
      <description>&lt;P&gt;for me, using above mentioned script and expression in Qlikview in a textbox, it is 2.&lt;/P&gt;&lt;P&gt;not able to test on sense but normally should be the same....&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Unbenannt.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/21786i3C0E736369384BC8/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unbenannt.png" alt="Unbenannt.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;P.S: Maybe its due to the field names as i used "_" inside the fieldnames&lt;/P&gt;&lt;P&gt;Maybe just change the fieldnames according your environment:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;=count({&amp;lt;[Date b]={"=[Date a] &amp;lt; [Date b] and Condition_a = 1 and  Condition_b =1 and year([Date a]) = 2019 and [Date b]&amp;lt;&amp;gt; 'tbd' and [Date b]&amp;lt;&amp;gt; Null()"}&amp;gt;}[Date a])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2019 11:02:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-analysis-with-multiple-conditions/m-p/1636613#M47424</guid>
      <dc:creator>Frank_Hartmann</dc:creator>
      <dc:date>2019-10-17T11:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis with multiple conditions</title>
      <link>https://community.qlik.com/t5/App-Development/Set-analysis-with-multiple-conditions/m-p/1636619#M47425</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/29675"&gt;@Frank_Hartmann&lt;/a&gt;&amp;nbsp;:&lt;/P&gt;&lt;P&gt;I tried on Qlik sense : count({&amp;lt;Date_b={"=Date_a &amp;lt; Date_b and Condition_a = 1 and Condition_b =1 and year(Date_a) = 2019 and Date_b &amp;lt;&amp;gt; 'tbd' and Date_b &amp;lt;&amp;gt; Null()"}&amp;gt;}Date_a)&lt;/P&gt;&lt;P&gt;It returned 2 as well.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/88812"&gt;@almosthuman&lt;/a&gt;&amp;nbsp;: it might be a problem in date format of date_a and date_b which cause the Date_a &amp;lt; Date_b not correct.&lt;/P&gt;&lt;P&gt;Below script might fix the date format. FYR&lt;/P&gt;&lt;P&gt;SET ThousandSep=',';&lt;BR /&gt;SET DecimalSep='.';&lt;BR /&gt;SET MoneyThousandSep=',';&lt;BR /&gt;SET MoneyDecimalSep='.';&lt;BR /&gt;SET MoneyFormat='$#,##0.00;-$#,##0.00';&lt;BR /&gt;SET TimeFormat='h:mm:ss TT';&lt;BR /&gt;SET DateFormat='DD.MM.YYYY';&lt;BR /&gt;SET TimestampFormat='DD.MM.YYYY h:mm:ss[.fff] TT';&lt;BR /&gt;SET FirstWeekDay=6;&lt;BR /&gt;SET BrokenWeeks=1;&lt;BR /&gt;SET ReferenceDay=0;&lt;BR /&gt;SET FirstMonthOfYear=1;&lt;BR /&gt;SET CollationLocale='en-US';&lt;BR /&gt;SET CreateSearchIndexOnReload=1;&lt;BR /&gt;SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';&lt;BR /&gt;SET LongMonthNames='January;February;March;April;May;June;July;August;September;October;November;December';&lt;BR /&gt;SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';&lt;BR /&gt;SET LongDayNames='Monday;Tuesday;Wednesday;Thursday;Friday;Saturday;Sunday';&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;BR /&gt;Condition_a, Condition_b, Date_a, Date_b&lt;BR /&gt;1, 1, 12.01.2019, 30.01.2019&lt;BR /&gt;1, 0, 12.05.2019, 12.05.2019&lt;BR /&gt;0, 1, 15.03.2019, 15.03.2019&lt;BR /&gt;1, 1, 28.06.2018, 15.05.2019&lt;BR /&gt;1, 1, 05.05.2019, tbd&lt;BR /&gt;1, 1, 01.03.2019&lt;BR /&gt;1, 1, 09.10.2019, 25.05.2020&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;[autoCalendar]:&lt;BR /&gt;DECLARE FIELD DEFINITION Tagged ('$date')&lt;BR /&gt;FIELDS&lt;BR /&gt;Dual(Year($1), YearStart($1)) AS [Year] Tagged ('$axis', '$year'),&lt;BR /&gt;Dual('Q'&amp;amp;Num(Ceil(Num(Month($1))/3)),Num(Ceil(NUM(Month($1))/3),00)) AS [Quarter] Tagged ('$quarter', '$cyclic'),&lt;BR /&gt;Dual(Year($1)&amp;amp;'-Q'&amp;amp;Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [YearQuarter] Tagged ('$yearquarter', '$qualified'),&lt;BR /&gt;Dual('Q'&amp;amp;Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [_YearQuarter] Tagged ('$yearquarter', '$hidden', '$simplified'),&lt;BR /&gt;Month($1) AS [Month] Tagged ('$month', '$cyclic'),&lt;BR /&gt;Dual(Year($1)&amp;amp;'-'&amp;amp;Month($1), monthstart($1)) AS [YearMonth] Tagged ('$axis', '$yearmonth', '$qualified'),&lt;BR /&gt;Dual(Month($1), monthstart($1)) AS [_YearMonth] Tagged ('$axis', '$yearmonth', '$simplified', '$hidden'),&lt;BR /&gt;Dual('W'&amp;amp;Num(Week($1),00), Num(Week($1),00)) AS [Week] Tagged ('$weeknumber', '$cyclic'),&lt;BR /&gt;Date(Floor($1)) AS [Date] Tagged ('$axis', '$date', '$qualified'),&lt;BR /&gt;Date(Floor($1), 'D') AS [_Date] Tagged ('$axis', '$date', '$hidden', '$simplified'),&lt;BR /&gt;If (DayNumberOfYear($1) &amp;lt;= DayNumberOfYear(Today()), 1, 0) AS [InYTD] ,&lt;BR /&gt;Year(Today())-Year($1) AS [YearsAgo] ,&lt;BR /&gt;If (DayNumberOfQuarter($1) &amp;lt;= DayNumberOfQuarter(Today()),1,0) AS [InQTD] ,&lt;BR /&gt;4*Year(Today())+Ceil(Month(Today())/3)-4*Year($1)-Ceil(Month($1)/3) AS [QuartersAgo] ,&lt;BR /&gt;Ceil(Month(Today())/3)-Ceil(Month($1)/3) AS [QuarterRelNo] ,&lt;BR /&gt;If(Day($1)&amp;lt;=Day(Today()),1,0) AS [InMTD] ,&lt;BR /&gt;12*Year(Today())+Month(Today())-12*Year($1)-Month($1) AS [MonthsAgo] ,&lt;BR /&gt;Month(Today())-Month($1) AS [MonthRelNo] ,&lt;BR /&gt;If(WeekDay($1)&amp;lt;=WeekDay(Today()),1,0) AS [InWTD] ,&lt;BR /&gt;(WeekStart(Today())-WeekStart($1))/7 AS [WeeksAgo] ,&lt;BR /&gt;Week(Today())-Week($1) AS [WeekRelNo] ;&lt;/P&gt;&lt;P&gt;DERIVE FIELDS FROM FIELDS Date_a, Date_b USING [autoCalendar] ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2019 11:08:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-analysis-with-multiple-conditions/m-p/1636619#M47425</guid>
      <dc:creator>thi_pham</dc:creator>
      <dc:date>2019-10-17T11:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis with multiple conditions</title>
      <link>https://community.qlik.com/t5/App-Development/Set-analysis-with-multiple-conditions/m-p/1636739#M47436</link>
      <description>&lt;P&gt;You can solve this at load time...&lt;/P&gt;&lt;P&gt;Script:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SET HidePrefix = '_';
LET vCurrentYear = Year(Today());

Test:
NOCONCATENATE
LOAD
	RowNo() AS [ID],
	*,
	If(Year([Date a]) = $(vCurrentYear) And [Date a] &amp;lt; [Date b]
    	And [Condition a] And [Condition b], 1, 0) AS [_Flag]
;
LOAD 
    [Condition a], 
    [Condition b], 
    Alt(Date(Date#([Date 1], 'DD.MM.YYYY'), 'DD/MM/YYYY'), Null()) AS [Date a],
    Alt(Date(Date#([Date 2], 'DD.MM.YYYY'), 'DD/MM/YYYY'), Null()) AS [Date b]
;
LOAD * INLINE [
    Condition a, Condition b, Date 1, 	  Date 2
    1, 			 1, 		  12.01.2019, 30.01.2019
    1, 			 0, 		  12.05.2019, 12.05.2019
    0, 			 1, 		  15.03.2019, 15.03.2019
    1, 			 1, 		  28.06.2018, 15.05.2019
    1, 			 1, 		  05.05.2019, tbd
    1, 			 1, 		  01.03.2019, 
    1, 			 1, 		  09.10.2019, 25.05.2020
];&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Measure:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sum(_Flag)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Result:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="clipboard_image_0.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/21802iF9D9545E9D2E4312/image-size/large?v=v2&amp;amp;px=999" role="button" title="clipboard_image_0.png" alt="clipboard_image_0.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2019 13:48:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-analysis-with-multiple-conditions/m-p/1636739#M47436</guid>
      <dc:creator>JGMDataAnalysis</dc:creator>
      <dc:date>2019-10-17T13:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: Set analysis with multiple conditions</title>
      <link>https://community.qlik.com/t5/App-Development/Set-analysis-with-multiple-conditions/m-p/1636773#M47443</link>
      <description>&lt;P&gt;Use &lt;STRONG&gt;[_Flag]&lt;/STRONG&gt; as a set modifier to filter the table.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="clipboard_image_0.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/21809iE9630E00D10FC005/image-size/large?v=v2&amp;amp;px=999" role="button" title="clipboard_image_0.png" alt="clipboard_image_0.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2019 14:29:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Set-analysis-with-multiple-conditions/m-p/1636773#M47443</guid>
      <dc:creator>JGMDataAnalysis</dc:creator>
      <dc:date>2019-10-17T14:29:09Z</dc:date>
    </item>
  </channel>
</rss>

