<?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 Default Values Between Two Dates in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130277#M9169</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am working with a &lt;STRONG style="text-decoration: underline;"&gt;Qlik Sense&lt;/STRONG&gt; sheet where the requirement is to default the data displayed to a predetermined time frame (last 30 days) unless the user selects data in one of the filters.&amp;nbsp; I have created two variables to store the from and to dates and I can get the expression below to work but the performance is terrible.&amp;nbsp; I am hoping someone has an alternative solution.&amp;nbsp; Below is the expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first part of the expression evaluates if one of the filter has been selected.&amp;nbsp; If not then it looks for all of the values of TranDateTime between the two variables.&amp;nbsp; Otherwise it bases the dates on the filters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=IF(ISNULL(GetFieldSelections(BillingMonthNameAbbr)) AND ISNULL(GetFieldSelections([Transaction Date])) AND ISNULL(GetFieldSelections([Transaction Month])) AND IsNull(GetFieldSelections([Transaction Week])),&lt;/P&gt;&lt;P&gt;IF(DATE(TranDateTime)&amp;gt;='$(vExceptFrom)' AND DATE(TranDateTime)&amp;lt;='$(vExceptTo)',TranDateTime),&lt;/P&gt;&lt;P&gt;IF([Fuel Exception Type]='Exceeds Non-Fuel Limit',TranDateTime))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Oct 2018 17:43:58 GMT</pubDate>
    <dc:creator>bbergstrom</dc:creator>
    <dc:date>2018-10-23T17:43:58Z</dc:date>
    <item>
      <title>Default Values Between Two Dates</title>
      <link>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130277#M9169</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am working with a &lt;STRONG style="text-decoration: underline;"&gt;Qlik Sense&lt;/STRONG&gt; sheet where the requirement is to default the data displayed to a predetermined time frame (last 30 days) unless the user selects data in one of the filters.&amp;nbsp; I have created two variables to store the from and to dates and I can get the expression below to work but the performance is terrible.&amp;nbsp; I am hoping someone has an alternative solution.&amp;nbsp; Below is the expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first part of the expression evaluates if one of the filter has been selected.&amp;nbsp; If not then it looks for all of the values of TranDateTime between the two variables.&amp;nbsp; Otherwise it bases the dates on the filters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=IF(ISNULL(GetFieldSelections(BillingMonthNameAbbr)) AND ISNULL(GetFieldSelections([Transaction Date])) AND ISNULL(GetFieldSelections([Transaction Month])) AND IsNull(GetFieldSelections([Transaction Week])),&lt;/P&gt;&lt;P&gt;IF(DATE(TranDateTime)&amp;gt;='$(vExceptFrom)' AND DATE(TranDateTime)&amp;lt;='$(vExceptTo)',TranDateTime),&lt;/P&gt;&lt;P&gt;IF([Fuel Exception Type]='Exceeds Non-Fuel Limit',TranDateTime))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2018 17:43:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130277#M9169</guid>
      <dc:creator>bbergstrom</dc:creator>
      <dc:date>2018-10-23T17:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: Default Values Between Two Dates</title>
      <link>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130278#M9170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brian.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GetFieldSelections is quite expensive as far as I know. I would try count, to count the selected items and see if it's equal to the total count (the count without selections):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;=IF(Count(BillingMonthNameAbbr)=Count({&amp;lt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;BillingMonthNameAbbr=&amp;gt;} &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;BillingMonthNameAbbr)&lt;/SPAN&gt;&lt;/SPAN&gt; AND ...//Continue this logic&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Thanks&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Kingsley&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2018 19:45:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130278#M9170</guid>
      <dc:creator>kingsley101</dc:creator>
      <dc:date>2018-10-23T19:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Default Values Between Two Dates</title>
      <link>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130279#M9171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So the count of the selections could be anywhere from 1 to all of the available values.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2018 20:51:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130279#M9171</guid>
      <dc:creator>bbergstrom</dc:creator>
      <dc:date>2018-10-23T20:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: Default Values Between Two Dates</title>
      <link>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130280#M9172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please can you try GetSelectedCount() instead and see if the performance improves.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2018 06:56:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130280#M9172</guid>
      <dc:creator>kingsley101</dc:creator>
      <dc:date>2018-10-24T06:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: Default Values Between Two Dates</title>
      <link>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130281#M9173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It sort of works.&amp;nbsp; I tested it in a text box and it worked through the logic correctly.&amp;nbsp; When I modified my original expression in the table object the following is giving me an Invalid dimension error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=IF(COUNT(BillingMonthNameAbbr)=COUNT({&amp;lt;BillingMonthNameAbbr=&amp;gt;}BillingMonthNameAbbr),&lt;/P&gt;&lt;P&gt;IF(DATE(TranDateTime)&amp;gt;='$(vExceptFrom)' AND DATE(TranDateTime)&amp;lt;='$(vExceptTo)',TranDateTime),&lt;/P&gt;&lt;P&gt;IF(FETCCount=1,TranDateTime))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2018 13:36:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130281#M9173</guid>
      <dc:creator>bbergstrom</dc:creator>
      <dc:date>2018-10-24T13:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: Default Values Between Two Dates</title>
      <link>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130282#M9174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Hi Brian.&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Please try it by replacing GetFieldSelections() with GetSelectedCount(). I think it'll be more effecient but you will need to try on your model&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;=IF(GetSelectedCount(BillingMonthNameAbbr)=0 AND &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12px;"&gt;GetSelectedCount&lt;/SPAN&gt;([Transaction Date])=0 AND &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12px;"&gt;GetSelectedCount&lt;/SPAN&gt;([Transaction Month])=0 AND &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12px;"&gt;GetSelectedCount&lt;/SPAN&gt;([Transaction Week])=0,&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;IF(DATE(TranDateTime)&amp;gt;='$(vExceptFrom)' AND DATE(TranDateTime)&amp;lt;='$(vExceptTo)',TranDateTime),&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;IF([Fuel Exception Type]='Exceeds Non-Fuel Limit',TranDateTime))&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2018 13:56:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130282#M9174</guid>
      <dc:creator>kingsley101</dc:creator>
      <dc:date>2018-10-24T13:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: Default Values Between Two Dates</title>
      <link>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130283#M9175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;While that worked the performance is about the same.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2018 14:15:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130283#M9175</guid>
      <dc:creator>bbergstrom</dc:creator>
      <dc:date>2018-10-24T14:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: Default Values Between Two Dates</title>
      <link>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130284#M9176</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Would it make more sense to affect the variables?&amp;nbsp; In my case the vExceptFrom and vExceptTo variables are loaded via the loadscript (qvs).&amp;nbsp; Could I create a new variable where the default value is vExceptFrom and then change the variable to the values selected in the filter pane if any are selected?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2018 14:23:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130284#M9176</guid>
      <dc:creator>bbergstrom</dc:creator>
      <dc:date>2018-10-24T14:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: Default Values Between Two Dates</title>
      <link>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130285#M9177</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brian.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Changing the variables won't make a noticeable advancement in the performance. It's most definitely the GetFieldSelections and GetSelectedCount functions are expensive. Please can you attach your qvf or qvw.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2018 14:31:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130285#M9177</guid>
      <dc:creator>kingsley101</dc:creator>
      <dc:date>2018-10-24T14:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: Default Values Between Two Dates</title>
      <link>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130286#M9178</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sadly I cannot post the qvf as it would expose sensitive data.&amp;nbsp; Do you know why the following didn't work in the table object:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;COUNT(BillingMonthNameAbbr)=COUNT({&amp;lt;BillingMonthNameAbbr=&amp;gt;}BillingMonthNameAbbr)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2018 15:05:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130286#M9178</guid>
      <dc:creator>bbergstrom</dc:creator>
      <dc:date>2018-10-24T15:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: Default Values Between Two Dates</title>
      <link>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130287#M9179</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Hi Brian.&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Assuming that is the condition you used within the expression and not the entire expression itself:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Please see my attached qvf. It works perfectly for me. Is there a chance the user has selected another field? (eg. if you select a customer, due to association, you will only see invoice numbers for that customer, and because that customer has only been invoiced once, 1 isn't equal to the total of 10 invoices numbers -IF(Count(Invoice#)=Count({&amp;lt;Invoice#=&amp;gt;}Invoice#,'No selections have been made','Selections have been made)&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;)&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;The code works, it's likely that something is selected without you knowing.&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2018 06:34:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130287#M9179</guid>
      <dc:creator>kingsley101</dc:creator>
      <dc:date>2018-10-25T06:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: Default Values Between Two Dates</title>
      <link>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130288#M9180</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are trying to gain efficiency, it is better to convert the if statements to set analysis.&amp;nbsp; I am seeing two types of set equations, one if the user has not made date selections and one if the user has made date selections.&amp;nbsp; So the below formula will only check once if the the user has made a selection and then provide the appropriate set analysis, either the date range for the default selections (variables) or if date range is selected the FETCCount, no reason in the second set analysis to use TranDateTime because the user has already selected it. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Count({&amp;lt;$(=if((GetSelectedCount(BillingMonthNameAbbr)+GetSelectedCount([Transaction Date])+GetSelectedCount([Transaction Month])+GetSelectedCount([Transaction Week]))=0,'TranDateTime={"&amp;gt;='&amp;amp;date(vExceptFrom)&amp;amp;'&amp;lt;='&amp;amp;date(vExceptTo)&amp;amp;'"}','FETCCount={1}'))&amp;gt;} distinct TranDateTime)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2018 11:44:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130288#M9180</guid>
      <dc:creator>tomhoch2</dc:creator>
      <dc:date>2018-10-25T11:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: Default Values Between Two Dates</title>
      <link>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130289#M9181</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did have another filter applied.&amp;nbsp; I'll modify the expression to ignore the other filters available and give it a whirl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Oct 2018 13:30:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Default-Values-Between-Two-Dates/m-p/130289#M9181</guid>
      <dc:creator>bbergstrom</dc:creator>
      <dc:date>2018-10-25T13:30:10Z</dc:date>
    </item>
  </channel>
</rss>

