<?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: sorting date field ; sorting concatenated field; sorting union of fields in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/sorting-date-field-sorting-concatenated-field-sorting-union-of/m-p/397090#M147927</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gysbert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for taking the time out to reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The function last_day() doesn't seem to work..Its in red colour in the expression editor, which means &lt;/P&gt;&lt;P&gt;qlikview isn't recognising it. Could you help me out here, please?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using version 9.00.7778.9&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Anju&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 01 Dec 2012 12:30:46 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-12-01T12:30:46Z</dc:date>
    <item>
      <title>sorting date field ; sorting concatenated field; sorting union of fields</title>
      <link>https://community.qlik.com/t5/QlikView/sorting-date-field-sorting-concatenated-field-sorting-union-of/m-p/397088#M147925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have problem while sorting fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have three queries...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table1:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select a.acc_display as Partner,b.bip_name as Channel&lt;/P&gt;&lt;P&gt;,c.cur_name as Currency&lt;/P&gt;&lt;P&gt;,sum(fpr.fpr_brl_amount) as TotalCost_Subscriber,sum(fpr.fpr_cal_base) as PayingBase_Subscriber,&lt;/P&gt;&lt;P&gt; case when sum(fpr.fpr_cal_base)=0 then 0 else sum(fpr.fpr_brl_amount)/sum(fpr.fpr_cal_base) end as &lt;SPAN style="color: #ff00ff;"&gt;UnitaryCost_Subscriber&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;trim(to_char(fpr.fpr_batch_dttm,'Month')|| ' ' || to_char(fpr.fpr_batch_dttm,'yyyy')) as BatchMonth,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;max(fpr.fpr_batch_dttm) as batchdttm_table1,&lt;/P&gt;&lt;P&gt;max(fpr.BTB_ID) as BTB_ID&lt;/P&gt;&lt;P&gt;from final_provisional_result fpr&lt;/P&gt;&lt;P&gt;join latest_prov_run_task_tab lt on fpr.pvr_id=lt.pvr_id&lt;/P&gt;&lt;P&gt;join bill_profile b on lt.bip_id=b.bip_id&lt;/P&gt;&lt;P&gt;join account a on a.acc_id=b.acc_id&lt;/P&gt;&lt;P&gt;join currency c on c.cur_id=fpr.bip_cur_id&lt;/P&gt;&lt;P&gt;group by a.acc_display,b.bip_name,c.cur_name, trim(to_char(fpr.fpr_batch_dttm,'Month')|| ' ' || to_char(fpr.fpr_batch_dttm,'yyyy')) order by batchdttm_table1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table2:&lt;/P&gt;&lt;P&gt;select a.acc_display as Partner&lt;/P&gt;&lt;P&gt;,c.cur_name as Currency&lt;/P&gt;&lt;P&gt;,sum(fvpr.fvr_brl_amount) as TotalCost_VOD,sum(fvpr.fvr_final_base) as PayingBase_VOD,&lt;/P&gt;&lt;P&gt; case when sum(fvpr.fvr_final_base)=0 then null else sum(fvpr.fvr_brl_amount)/sum(fvpr.fvr_final_base) end as &lt;SPAN style="color: #339966;"&gt;UnitaryCost_VOD&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;trim(to_char(bt.btb_to_dttm,'Month')|| ' ' || to_char(bt.btb_to_dttm,'yyyy')) as BatchMonth,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;max(bt.btb_to_dttm) as batchdttm_table2,&lt;/P&gt;&lt;P&gt;max(bt.BTB_ID) as BTB_ID&lt;/P&gt;&lt;P&gt;from&lt;/P&gt;&lt;P&gt;account a join&lt;/P&gt;&lt;P&gt;bill_profile b on a.acc_id=b.acc_id&lt;/P&gt;&lt;P&gt;join latest_vodppv_view lt on lt.bip_id=b.bip_id&lt;/P&gt;&lt;P&gt;join final_vod_ppv_result fvpr on fvpr.bip_id=b.bip_id&lt;/P&gt;&lt;P&gt;join batch_tbl bt on bt.btb_id=fvpr.btb_id&lt;/P&gt;&lt;P&gt;join currency c on c.cur_id=fvpr.bip_cur_id&lt;/P&gt;&lt;P&gt;where fvpr.fvr_recording_type='VOD'&lt;/P&gt;&lt;P&gt;//where fvpr.fvr_type_offered='VOD'&lt;/P&gt;&lt;P&gt;group by a.acc_display,c.cur_name, trim(to_char(bt.btb_to_dttm,'Month')|| ' ' || to_char(bt.btb_to_dttm,'yyyy')) order by batchdttm_table2;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table3:&lt;/P&gt;&lt;P&gt;select a.acc_display as Partner&lt;/P&gt;&lt;P&gt;,c.cur_name as Currency&lt;/P&gt;&lt;P&gt;,sum(fvpr.fvr_brl_amount) as TotalCost_PPV,sum(fvpr.fvr_final_base) as PayingBase_PPV,&lt;/P&gt;&lt;P&gt; case when sum(fvpr.fvr_final_base)=0 then null else sum(fvpr.fvr_brl_amount)/sum(fvpr.fvr_final_base) end as &lt;SPAN style="color: #0000ff;"&gt;UnitaryCost_PPV&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;trim(to_char(bt.btb_to_dttm,'Month')|| ' ' || to_char(bt.btb_to_dttm,'yyyy')) as BatchMonth,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;max(bt.btb_to_dttm) as batchdttm_table3,&lt;/P&gt;&lt;P&gt;max(bt.BTB_ID) as BTB_ID&lt;/P&gt;&lt;P&gt;from &lt;/P&gt;&lt;P&gt;account a join&lt;/P&gt;&lt;P&gt;bill_profile b on a.acc_id=b.acc_id&lt;/P&gt;&lt;P&gt;join latest_vodppv_view lt on lt.bip_id=b.bip_id&lt;/P&gt;&lt;P&gt;join final_vod_ppv_result fvpr on fvpr.bip_id=b.bip_id&lt;/P&gt;&lt;P&gt;join batch_tbl bt on bt.btb_id=fvpr.btb_id&lt;/P&gt;&lt;P&gt;join currency c on c.cur_id=fvpr.bip_cur_id&lt;/P&gt;&lt;P&gt;where fvpr.fvr_recording_type='PPV'&lt;/P&gt;&lt;P&gt;//where fvpr.fvr_type_offered='PPV'&lt;/P&gt;&lt;P&gt;group by a.acc_display,c.cur_name, trim(to_char(bt.btb_to_dttm,'Month')|| ' ' || to_char(bt.btb_to_dttm,'yyyy')) order by batchdttm_table3;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I load these results into three separate charts.&lt;/P&gt;&lt;P&gt;Now I need to create&amp;nbsp; a&amp;nbsp; 4th chart which will sum fields from 3 queries...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=(sum(TOTALCOST_VOD)+sum(TOTALCOST_PPV)+sum(TOTALCOST_SUBSCRIBER))/100000000// first exp&lt;/P&gt;&lt;P&gt;=(sum(&lt;SPAN style="color: #339966;"&gt;UNITARYCOST_VOD&lt;/SPAN&gt;)+sum(&lt;SPAN style="color: #0000ff;"&gt;UNITARYCOST_PPV&lt;/SPAN&gt;)+sum(&lt;SPAN style="color: #ff00ff;"&gt;UNITARYCOST_SUBSCRIBER&lt;/SPAN&gt;))/100000000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #ff0000;"&gt;the problem is 'BATCHMONTH' field will be union of batchmonth fields from all 3 queries.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #ff0000;"&gt;In the 4th chart , the months are being displayed in a random order. How do I sort it?&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #ff0000;"&gt;I tried a couple of sort expressions, but none of them are working.&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Dec 2012 08:21:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sorting-date-field-sorting-concatenated-field-sorting-union-of/m-p/397088#M147925</guid>
      <dc:creator />
      <dc:date>2012-12-01T08:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: sorting date field ; sorting concatenated field; sorting union of fields</title>
      <link>https://community.qlik.com/t5/QlikView/sorting-date-field-sorting-concatenated-field-sorting-union-of/m-p/397089#M147926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try creating BatchMonth in a format that can be sorted properly:&amp;nbsp; to_char(&lt;SPAN style="color: #333333;"&gt;fpr.fpr_batch_dttm,'YYYY MM') as BatchMonth,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333;"&gt;If you still need BatchMonth in the form 'January 2012' the you could use &lt;/SPAN&gt;last_day( &lt;SPAN style="color: #333333;"&gt;fpr.fpr_batch_dttm&lt;/SPAN&gt; ) to get the last day of the month as BatchMonth and do the formatting in the chart by setting it to 'MMMM YYYY' and set the sorting to numeric.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Dec 2012 10:33:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sorting-date-field-sorting-concatenated-field-sorting-union-of/m-p/397089#M147926</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2012-12-01T10:33:12Z</dc:date>
    </item>
    <item>
      <title>Re: sorting date field ; sorting concatenated field; sorting union of fields</title>
      <link>https://community.qlik.com/t5/QlikView/sorting-date-field-sorting-concatenated-field-sorting-union-of/m-p/397090#M147927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gysbert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for taking the time out to reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The function last_day() doesn't seem to work..Its in red colour in the expression editor, which means &lt;/P&gt;&lt;P&gt;qlikview isn't recognising it. Could you help me out here, please?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using version 9.00.7778.9&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Anju&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Dec 2012 12:30:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sorting-date-field-sorting-concatenated-field-sorting-union-of/m-p/397090#M147927</guid>
      <dc:creator />
      <dc:date>2012-12-01T12:30:46Z</dc:date>
    </item>
    <item>
      <title>Re: sorting date field ; sorting concatenated field; sorting union of fields</title>
      <link>https://community.qlik.com/t5/QlikView/sorting-date-field-sorting-concatenated-field-sorting-union-of/m-p/397091#M147928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;last_day() is an oracle sql function. You can use it in the sql statement. The qlikview equivalent is the monthend function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Dec 2012 12:42:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sorting-date-field-sorting-concatenated-field-sorting-union-of/m-p/397091#M147928</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2012-12-01T12:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: sorting date field ; sorting concatenated field; sorting union of fields</title>
      <link>https://community.qlik.com/t5/QlikView/sorting-date-field-sorting-concatenated-field-sorting-union-of/m-p/397092#M147929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gysbert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i am using this in my query..&lt;/P&gt;&lt;P&gt;to_char(fpr.fpr_batch_dttm,'YYYY MM') as BatchMonth,...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then, in qlikview..&lt;/P&gt;&lt;P&gt;i tried using a number of combinations in 'Calculated Dimension'&lt;/P&gt;&lt;P&gt;ex) month(BatchMonthTest)...Date()...etc...but&amp;nbsp; all of them returns null..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think I should be performing formatting modifications on BatchMonth in qlikview&amp;nbsp; rather than SQL due to data association reasons?..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also i tried using last_day()...In Oracle , the result is of format 31-JAN-12&lt;/P&gt;&lt;P&gt;but when I used the same field as dimension, it is being displayed as 1/31/2012 12:00:00 AM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Anju&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Dec 2012 13:20:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sorting-date-field-sorting-concatenated-field-sorting-union-of/m-p/397092#M147929</guid>
      <dc:creator />
      <dc:date>2012-12-01T13:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: sorting date field ; sorting concatenated field; sorting union of fields</title>
      <link>https://community.qlik.com/t5/QlikView/sorting-date-field-sorting-concatenated-field-sorting-union-of/m-p/397093#M147930</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;/P&gt;&lt;P&gt;I have one doubt,&lt;/P&gt;&lt;P&gt;max(last_day(fpr.fpr_batch_dttm)) as batchdttm_table1---if this is my sql field,&lt;/P&gt;&lt;P&gt;and if I am using monthname(batchdttm_table1) in qlikview, it gives me OCT 2012...is there any function which will give me October 2012?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Anju&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Dec 2012 13:40:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sorting-date-field-sorting-concatenated-field-sorting-union-of/m-p/397093#M147930</guid>
      <dc:creator />
      <dc:date>2012-12-01T13:40:09Z</dc:date>
    </item>
    <item>
      <title>Re: sorting date field ; sorting concatenated field; sorting union of fields</title>
      <link>https://community.qlik.com/t5/QlikView/sorting-date-field-sorting-concatenated-field-sorting-union-of/m-p/397094#M147931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;MonthName returns a date formatted as MMM YYYY, but it also has a numeric date value. MonthEnd is a date. Dates can be formatted in lots of ways. You can do that in the script or in the charts. See attached qvw for some examples. You also need to check out the date functions in the help file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Dec 2012 14:11:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sorting-date-field-sorting-concatenated-field-sorting-union-of/m-p/397094#M147931</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2012-12-01T14:11:13Z</dc:date>
    </item>
    <item>
      <title>Re: sorting date field ; sorting concatenated field; sorting union of fields</title>
      <link>https://community.qlik.com/t5/QlikView/sorting-date-field-sorting-concatenated-field-sorting-union-of/m-p/397095#M147932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gysbert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My issue is resolved. Thanks a lot!&lt;/P&gt;&lt;P&gt;This is what I did..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I fetched this using query..&lt;/P&gt;&lt;P&gt;to_char(bt.btb_to_dttm,'YYYY MM') as BatchMonth,&lt;/P&gt;&lt;P&gt;max(last_day(bt.btb_to_dttm)) as BatchMonth_format&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then in the dimension field, I gave =date(BATCHMONTH_FORMAT,'MMMM YYYY')&lt;/P&gt;&lt;P&gt;and in the sort by tab, I gave BatchMonth..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Anju&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Dec 2012 05:34:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/sorting-date-field-sorting-concatenated-field-sorting-union-of/m-p/397095#M147932</guid>
      <dc:creator />
      <dc:date>2012-12-03T05:34:36Z</dc:date>
    </item>
  </channel>
</rss>

