<?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: Expression from SQL query in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461890#M792697</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be this?&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;&lt;STRONG&gt;Sum(Aggr(Count({&amp;lt; type_of_activity_id -={8}, deleted = {0} &amp;gt;}, distinct initiate_date), user_id))&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Jan 2018 12:02:57 GMT</pubDate>
    <dc:creator>Anil_Babu_Samineni</dc:creator>
    <dc:date>2018-01-10T12:02:57Z</dc:date>
    <item>
      <title>Expression from SQL query</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461889#M792696</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to get an expression to do the same thing in a pivot table as an SQL query. &lt;/P&gt;&lt;P&gt;The dimension I'm using in the said pivot table is user_id.&lt;/P&gt;&lt;P&gt;So, the query is: &lt;/P&gt;&lt;P&gt;SELECT DISTINCT user_id,date(initiate_date),&lt;/P&gt;&lt;P&gt;count(distinct date(initiate_date))&amp;nbsp; &lt;/P&gt;&lt;P&gt;FROM Activity&lt;/P&gt;&lt;P&gt;WHERE&lt;/P&gt;&lt;P&gt;deleted = 0&lt;/P&gt;&lt;P&gt;and type_of_activity_id != 8&lt;/P&gt;&lt;P&gt;Group By user_id;&lt;/P&gt;&lt;P&gt;I've tried with:&lt;BR /&gt;Count({&amp;lt; type_of_activity_id -={8}, deleted = {0} &amp;gt;}, distinct initiate_date) but the results of the said expression are not correct for some users. &lt;BR /&gt;My question is: Is there any other way of writing the said expression? Am I missing something? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461889#M792696</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Expression from SQL query</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461890#M792697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be this?&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;&lt;STRONG&gt;Sum(Aggr(Count({&amp;lt; type_of_activity_id -={8}, deleted = {0} &amp;gt;}, distinct initiate_date), user_id))&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jan 2018 12:02:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461890#M792697</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2018-01-10T12:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: Expression from SQL query</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461891#M792699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Dimension: &lt;/STRONG&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;STRONG&gt;user_id&lt;/STRONG&gt;&lt;/SPAN&gt;&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;&lt;STRONG&gt;=Count({&amp;lt; type_of_activity_id -={8}, deleted = {0} &amp;gt;}Distinct initiate_date)&lt;/STRONG&gt;&lt;/SPAN&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;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&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;&lt;STRONG&gt;looks correct.&lt;/STRONG&gt;&lt;/SPAN&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;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&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;&lt;STRONG&gt;What is the format of the initiate_date?&lt;/STRONG&gt;&lt;/SPAN&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;&lt;STRONG&gt;share the sample file or screenshot the initiate_date?&lt;/STRONG&gt;&lt;/SPAN&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;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&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;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jan 2018 12:05:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461891#M792699</guid>
      <dc:creator>mdmukramali</dc:creator>
      <dc:date>2018-01-10T12:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: Expression from SQL query</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461892#M792702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;initiate_date's format is datetime. Could this be the issue? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jan 2018 12:22:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461892#M792702</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-10T12:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: Expression from SQL query</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461893#M792704</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My response here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/thread/287254"&gt;MySQL to Qlikview Expression translation&lt;/A&gt;&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;May be this&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;Dimension&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;User&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;Date(Floor(initiated_date)) &lt;/STRONG&gt;-&amp;gt; Calculated dimension&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;Expression&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;Count(DISTINCT initiated_date)&lt;/STRONG&gt;&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;This is useful assuming initiated_date is a timestamp... else all you will get is 1 for each row&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jan 2018 12:23:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461893#M792704</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-01-10T12:23:35Z</dc:date>
    </item>
    <item>
      <title>Re: Expression from SQL query</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461894#M792706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;initiated_date is datetime format. And yes, I am getting 1s for each row. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jan 2018 12:26:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461894#M792706</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-10T12:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: Expression from SQL query</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461895#M792709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So for a single user, do you have more than one timestamp in a day? For instance user xyz have 01/10/2018 8 am and 01/10/2018 10 am?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jan 2018 12:28:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461895#M792709</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-01-10T12:28:06Z</dc:date>
    </item>
    <item>
      <title>Re: Expression from SQL query</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461896#M792711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, there is a possibility that one user may have multiple timestamps in a day. Now that I look in the pivot table, there are users with more than one timestamps in a day and I assume my Count expression is counting the multiple timestamps too.&lt;BR /&gt;So the issue is with the initiated_date formatting?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jan 2018 12:32:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461896#M792711</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-10T12:32:49Z</dc:date>
    </item>
    <item>
      <title>Re: Expression from SQL query</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461897#M792712</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is the issue? I am not sure I understand?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;You want to see user and Date and count the number of timestamps for a user on a date, right? &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;then this should work?&lt;/SPAN&gt;&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;Dimension&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;User&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;Date(Floor(initiated_date)) &lt;/STRONG&gt;-&amp;gt; Calculated dimension&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;Expression&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;Count(DISTINCT initiated_date)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jan 2018 12:35:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461897#M792712</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-01-10T12:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: Expression from SQL query</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461898#M792713</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, I probably didn't expressed myself properly. &lt;BR /&gt;I want to see user and count the distinct number of dates, disregarding the time component (I'm doing it in the loading script), for each user, in the pivot table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jan 2018 13:16:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461898#M792713</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-10T13:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: Expression from SQL query</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461899#M792714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Then try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dimension&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;User&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expression&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Count(DISTINCT Floor(initiated_date))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jan 2018 13:17:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461899#M792714</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-01-10T13:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: Expression from SQL query</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461900#M792715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;disregarding the time component (&lt;STRONG&gt;I'm doing it in the loading script&lt;/STRONG&gt;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;How are you doing this? Are you using Just Date() function or Are you using Date(Floor()) functions? The reason I ask this is because a lot of the time users think that Date() function will truncate the time component, but it is not true. Date function is just a formatting function... it will display you as a date, but the underlying will still have time in it. In order to remove time, you need to use Floor() or you can use DayName() function to get rid of the time part and give it a format all at once&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jan 2018 13:20:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461900#M792715</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-01-10T13:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: Expression from SQL query</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461901#M792716</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;......I was just using the Date() function. God, thanks a lot man, you got me out of a problem I had to deal with for a couple of days!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jan 2018 13:31:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-from-SQL-query/m-p/1461901#M792716</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-01-10T13:31:49Z</dc:date>
    </item>
  </channel>
</rss>

