<?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: Week sort in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3149519#M112778</link>
    <description>&lt;P&gt;Hello Anonymous&lt;/LI-USER&gt;&amp;nbsp;, if you are looking to only sort, then use the following added column&lt;/P&gt;&lt;P&gt;Week sort = FORMAT(Calendar[Date],"yyyyww")&lt;/P&gt;</description>
    <pubDate>Thu, 23 Mar 2023 10:42:22 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-03-23T10:42:22Z</dc:date>
    <item>
      <title>Week sort</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3149344#M112768</link>
      <description>&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please help me with the following,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a column Week , which contains begging and end of week,&lt;/P&gt;&lt;P&gt;I was planning to sort it by date, but power bi returns an error "Sort by another column" ,&lt;/P&gt;&lt;P&gt;stating that there are multiple values in Column Date for Column Week, which I was trying to sort,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Therefore , I created column Week_sort that technically should be working, but it doesn't coz at the end of the year a row from column Week links to two different values from column Week_sort ,&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;any ideas how to solve this problem?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my initial idea was to:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;day_rank = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RANKX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;'Calendar'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;'Calendar'&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt;,,&lt;/SPAN&gt;&lt;SPAN&gt;ASC&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;which returns ranking of days,&lt;/P&gt;&lt;P&gt;and then "somehow" make DAX to repeat value from row above if row values in column Week are equal?&lt;/P&gt;&lt;P&gt;unfortunatelly i couldn't figure it out on my own&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;p.s. this table is created in DAX so I can't fix the problem in PQ&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 09:31:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3149344#M112768</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-03-23T09:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: Week sort</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3149465#M112774</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;Try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;day_rank =
RANKX ( 'Calendar', 'Calendar'[Week],, ASC, Dense )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 10:12:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3149465#M112774</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-03-23T10:12:09Z</dc:date>
    </item>
    <item>
      <title>Re: Week sort</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3149475#M112776</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your quick response!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sorry, I forgot to mention, that won't work coz Week is a text values, and ranking it doesn't give correct (compared to date) result, as you can see here, 14th week of April 2019 is ranked 1st , even though, there are weeks before it&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 10:16:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3149475#M112776</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-03-23T10:16:45Z</dc:date>
    </item>
    <item>
      <title>Re: Week sort</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3149519#M112778</link>
      <description>&lt;P&gt;Hello Anonymous&lt;/a&gt;&amp;nbsp;, if you are looking to only sort, then use the following added column&lt;/P&gt;&lt;P&gt;Week sort = FORMAT(Calendar[Date],"yyyyww")&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 10:42:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3149519#M112778</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-03-23T10:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: Week sort</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3149546#M112781</link>
      <description>&lt;P&gt;hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;that's not gonna work &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 10:53:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3149546#M112781</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-03-23T10:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: Week sort</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3149572#M112783</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Aha. Then please try&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;day_rank =
RANKX (
    'Calendar',
    VALUE ( SUBSTITUTE ( 'Calendar'[Week_Sort], "_", "" ) ),
    ASC,
    Dense
)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 23 Mar 2023 11:03:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3149572#M112783</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-03-23T11:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: Week sort</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3149606#M112787</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;same problem,&lt;/P&gt;&lt;P&gt;one value from Week column links to two values from Day_rank column&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 11:15:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3149606#M112787</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-03-23T11:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: Week sort</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3149634#M112790</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;These are in two different years. The week sort says one is the last week of 2018 and the other is the first week 2019.&amp;nbsp; You shuld fix the week sort column, either to consider these 7 days as the last week of 2018 or to consider then as the first week of 2019. I mean week and week sort must be alligned.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 11:26:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3149634#M112790</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-03-23T11:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: Week sort</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3149688#M112792</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I see, but how? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Formula in Week column is:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Week = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FORMAT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;'Calendar'&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt; - &lt;/SPAN&gt;&lt;SPAN&gt;WEEKDAY&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Calendar'&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;)+&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;"dd-MMM"&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;amp;&lt;/SPAN&gt;&lt;SPAN&gt;" - "&lt;/SPAN&gt;&lt;SPAN&gt;&amp;amp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FORMAT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;'Calendar'&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt; - &lt;/SPAN&gt;&lt;SPAN&gt;WEEKDAY&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Calendar'&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;)+&lt;/SPAN&gt;&lt;SPAN&gt;7&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;"dd-MMM"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;and it's automatically catches those days, it there a way to limit which days fall into which week?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 11:37:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3149688#M112792</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-03-23T11:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: Week sort</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3151593#M112882</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Please try&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Week =
FORMAT ( 'Calendar'[Date] - WEEKDAY ( 'Calendar'[Date], 2 ) + 1, "dd-MMM" ) &amp;amp; " - "
    &amp;amp; FORMAT (
        MIN (
            'Calendar'[Date] - WEEKDAY ( 'Calendar'[Date], 2 ) + 7,
            ENDOFYEAR ( 'Calendar'[Date] )
        ),
        "dd-MMM"
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 24 Mar 2023 04:54:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3151593#M112882</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-03-24T04:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: Week sort</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3151804#M112908</link>
      <description>&lt;P&gt;your solution works&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp; and will accept it,&lt;BR /&gt;but it creates this short week containing only one day, and I know my colleagues will ask why&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;do you maybe know if it's possible to somehow repeat a value from row above on condition from other column,&lt;BR /&gt;like here, I did rankx of Date column&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;day_rank = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RANKX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;'Calendar'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;'Calendar'&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt;,,&lt;/SPAN&gt;&lt;SPAN&gt;ASC&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;BR /&gt;&lt;/SPAN&gt;and maybe it's possible to write a logical function ( using REPT, IF, EARLIER) that will check if next row in Week column is equial to previous one, if true, then repeat Day_rank row, if not then Day_rank?&lt;BR /&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;img /&gt;&lt;P&gt;thanks for all your help!&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 24 Mar 2023 07:28:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3151804#M112908</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-03-24T07:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: Week sort</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3151836#M112912</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;You are digging in the wrong location. When to stop repeating? That brings you back to the original problem of ranking using the correct granularity. This is an infinite loop and will lead to nowhere.&lt;/P&gt;
&lt;P&gt;The issue is that your business logic wasn't clarified so I had to guess. You can achieve this using&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;day_rank =
RANKX (
    'Calendar',
    'Calendar'[Date] - WEEKDAY ( 'Calendar'[Date], 2 ),
    ASC,
    DENSE
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2023 07:49:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3151836#M112912</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-03-24T07:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: Week sort</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3151876#M112918</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;BR /&gt;well the last solution actually works fine, thanks again &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2023 08:04:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Week-sort/m-p/3151876#M112918</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-03-24T08:04:57Z</dc:date>
    </item>
  </channel>
</rss>

