<?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: Conditional Formatting broken by Custom Sort in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-broken-by-Custom-Sort/m-p/2887410#M93641</link>
    <description>&lt;P&gt;Not able to troubleshoot as one would need the file with the issue to see what's going on.&lt;/P&gt;</description>
    <pubDate>Sun, 06 Nov 2022 10:25:21 GMT</pubDate>
    <dc:creator>daXtreme</dc:creator>
    <dc:date>2022-11-06T10:25:21Z</dc:date>
    <item>
      <title>Conditional Formatting broken by Custom Sort</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-broken-by-Custom-Sort/m-p/2887276#M93624</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I was able to create a custom (non-alphabetic) sort order for column headers and rows, and I also want to apply conditional formatting to color-code the 1st and 2nd ranking values&amp;nbsp;&lt;U&gt;across a row&lt;/U&gt; (Excel mockup to illustrate desired behavior).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The DAX below works as a value to conditional format by, but when I apply the custom sort order on rows and columns, the color-coding breaks and everything becomes green.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;CF Rank = &lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;VAR cellRank = RANKX(ALLSELECTED(Mockup[Carrier]),&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; CALCULATE(SUM(Mockup[Sched Dprts])),,DESC)&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;RETURN&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; SWITCH(TRUE(),&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cellRank = 1,"Green",&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cellRank = 2,"Yellow")&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Do I need to do a custom sort within the DAX expression...use a SELECTEDVALUE to get at the intersected cell in the matrix? Any suggestions greatly appreciated as I'm a relative newbie.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks - Crystal&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 05 Nov 2022 21:23:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-broken-by-Custom-Sort/m-p/2887276#M93624</guid>
      <dc:creator>CrystalC</dc:creator>
      <dc:date>2022-11-05T21:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Formatting broken by Custom Sort</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-broken-by-Custom-Sort/m-p/2887362#M93633</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure how your datamodel looks like, but please try the below whether it suits your requirement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;CF Rank =
VAR cellRank =
    RANKX (
        ALLSELECTED ( Mockup[Carrier], Mockup[Sorting_column_carrier] ),
        CALCULATE ( SUM ( Mockup[Sched Dprts] ) ),
        ,
        DESC
    )
RETURN
    SWITCH ( TRUE (), cellRank = 1, "Green", cellRank = 2, "Yellow" )
&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 06 Nov 2022 04:37:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-broken-by-Custom-Sort/m-p/2887362#M93633</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2022-11-06T04:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Formatting broken by Custom Sort</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-broken-by-Custom-Sort/m-p/2887410#M93641</link>
      <description>&lt;P&gt;Not able to troubleshoot as one would need the file with the issue to see what's going on.&lt;/P&gt;</description>
      <pubDate>Sun, 06 Nov 2022 10:25:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-broken-by-Custom-Sort/m-p/2887410#M93641</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-11-06T10:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Formatting broken by Custom Sort</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-broken-by-Custom-Sort/m-p/2888728#M93711</link>
      <description>&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="467508" data-lia-user-login="CrystalC" class="lia-mention lia-mention-user"&gt;CrystalC&lt;/a&gt;&amp;nbsp;,&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;&amp;nbsp;&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;Please follow these steps:&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;(1)&lt;/SUP&gt; &lt;SUP&gt;My test data:&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;img /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;(2)&lt;/SUP&gt; &lt;SUP&gt;Add a new measure&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;CF Rank =

VAR _max =

    CALCULATE (

        MAX ( 'Mockup'[Sched Dprts] ),

        ALLEXCEPT ( Mockup, 'Mockup'[Carrier] )

    )

VAR _nextmax =

    CALCULATE (

        MAX ( 'Mockup'[Sched Dprts] ),

        FILTER ( ALL ( Mockup ), [Sched Dprts] &amp;lt; _max )

    )

RETURN

    SWITCH ( SUM ( Mockup[Sched Dprts] ), _max, "Green", _nextmax, "Yellow" )

&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;(3) The result is as follows :&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;img /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;img /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;Best Regards,&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;Gallen Luo&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SUP&gt;If this post &lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&lt;/SUP&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Nov 2022 09:01:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-broken-by-Custom-Sort/m-p/2888728#M93711</guid>
      <dc:creator>v-jialluo-msft</dc:creator>
      <dc:date>2022-11-07T09:01:21Z</dc:date>
    </item>
  </channel>
</rss>

