<?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 How to use weekday() function correctly? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-use-weekday-function-correctly/m-p/216036#M69436</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Actually I don't know for sure, but it seems, that WeekDay returns 0 for Monday.&lt;/P&gt;&lt;P&gt;To create Weekday field for Sun=0 try this expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;DUAL(TEXT(Weekday(TempDate)), MOD(Weekday(TempDate) +1, 7)) AS WeekDay&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;It will create a Dual type field with a text of weekday and value with 0 for Sunday&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Darius&lt;/P&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 Apr 2010 10:04:00 GMT</pubDate>
    <dc:creator>d_pranskus</dc:creator>
    <dc:date>2010-04-16T10:04:00Z</dc:date>
    <item>
      <title>How to use weekday() function correctly?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-weekday-function-correctly/m-p/216033#M69433</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;I'm having issue applying qlikview built-in function weekday().&lt;/P&gt;&lt;P&gt;On variable setting, i have the following:&lt;/P&gt;&lt;P&gt;SET DayNames='1;2;3;4;5;6;0';&lt;/P&gt;&lt;P&gt;In the script, when i use the weekday function i get the correct number but i won't get the correct name when i map to an inline load:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;DayNameMap:&lt;BR /&gt;mapping load * inline [&lt;BR /&gt;WeekdayNum, WeekdayName&lt;BR /&gt;0, Sun&lt;BR /&gt;1, Mon&lt;BR /&gt;2, Tue&lt;BR /&gt;3, Wed&lt;BR /&gt;4, Thu&lt;BR /&gt;5, Fri&lt;BR /&gt;6, Sat&lt;BR /&gt;0, Sun&lt;BR /&gt;];&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;When i change my OS regional setting, it doesn't change the result. I figure that when the weekday is mapped, it is treated as a number. When i use the num function, it will give me a different number. Please see attached file to get what i meant.&lt;/P&gt;&lt;P&gt;Any input is very appreciated. Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: bold"&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Apr 2010 04:24:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-weekday-function-correctly/m-p/216033#M69433</guid>
      <dc:creator />
      <dc:date>2010-04-16T04:24:34Z</dc:date>
    </item>
    <item>
      <title>How to use weekday() function correctly?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-weekday-function-correctly/m-p/216034#M69434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Actually Weekday() function returns a weekday value, which is of type &lt;B&gt;Dual&lt;/B&gt;. It has it's numeric value and textual representation. When you set SET DayNames='1;2;3;4;5;6;0' you are defining textual representation of the weekdays values. But the result of the numeric counterpart of WeekDay function value does not change. Here is a list of Text, Num pairs, you get as a result of WeekDay function&lt;/P&gt;&lt;P&gt;For Mon (1, 0)&lt;/P&gt;&lt;P&gt;For Tue (2, 1)&lt;/P&gt;&lt;P&gt;For Wed (3, 2)&lt;/P&gt;&lt;P&gt;For Thu (4, 3)&lt;/P&gt;&lt;P&gt;For Fri (5, 4)&lt;/P&gt;&lt;P&gt;For Sat (6, 5)&lt;/P&gt;&lt;P&gt;For Sun (0, 6)&lt;/P&gt;&lt;P&gt;When you call applymap function, actualy it uses numeric counterpart of the value. But as visual representation by default it shows textual representation you defined in WeekNames variable. (Try to change format of Weekday field from Mixed to Numeric and you should see that values representation changes).&lt;/P&gt;&lt;P&gt;To get a numeric value from it's textual representation try to use EVALUATE() function.&lt;/P&gt;&lt;P&gt;As to me I never use any mappings for weekdays.&lt;/P&gt;&lt;DIV&gt;Cheers&lt;/DIV&gt;&lt;DIV&gt;Darius&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Apr 2010 05:48:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-weekday-function-correctly/m-p/216034#M69434</guid>
      <dc:creator>d_pranskus</dc:creator>
      <dc:date>2010-04-16T05:48:17Z</dc:date>
    </item>
    <item>
      <title>How to use weekday() function correctly?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-weekday-function-correctly/m-p/216035#M69435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks so much Darius. I read in Ref Manual that this function is affected by the OS regional setting but it doesn't really explain what is the correct setting.&lt;/P&gt;&lt;P&gt;Do you know if the setting set in variable overwrite the OS regional setting ? Or Monday will always be 0 in Qlikview?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Apr 2010 08:00:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-weekday-function-correctly/m-p/216035#M69435</guid>
      <dc:creator />
      <dc:date>2010-04-16T08:00:45Z</dc:date>
    </item>
    <item>
      <title>How to use weekday() function correctly?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-weekday-function-correctly/m-p/216036#M69436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Actually I don't know for sure, but it seems, that WeekDay returns 0 for Monday.&lt;/P&gt;&lt;P&gt;To create Weekday field for Sun=0 try this expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;DUAL(TEXT(Weekday(TempDate)), MOD(Weekday(TempDate) +1, 7)) AS WeekDay&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;It will create a Dual type field with a text of weekday and value with 0 for Sunday&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Darius&lt;/P&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Apr 2010 10:04:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-weekday-function-correctly/m-p/216036#M69436</guid>
      <dc:creator>d_pranskus</dc:creator>
      <dc:date>2010-04-16T10:04:00Z</dc:date>
    </item>
    <item>
      <title>How to use weekday() function correctly?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-weekday-function-correctly/m-p/216037#M69437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We have a field called DayOfWeek that is created using the WeekDay() function. In one of our document files the values are listed as text (Sun, Mon, etc.). In another document using the exact same script to load DayOfWeek Qlikview is showing numeric data (0, 1, etc.). We want text in both documents what would be causing one to show in one format (text) and the other the other format (numeric)?&lt;/P&gt;&lt;P&gt;We want the text, Sun, Mon, etc.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Aug 2010 20:52:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-weekday-function-correctly/m-p/216037#M69437</guid>
      <dc:creator />
      <dc:date>2010-08-26T20:52:38Z</dc:date>
    </item>
  </channel>
</rss>

