<?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 Switch Table Custom Format failing to sort data correctly in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Switch-Table-Custom-Format-failing-to-sort-data-correctly/m-p/2775011#M86594</link>
    <description>&lt;DIV&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;When I use a custom format on my data, the data gets sorted based on the first number as shown below.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code I am using, I have tried with max instead of values and without stating that it can't be 0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also have used the "Currency" option, however this put all the negative numbers at the top of the list as they where in ().&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Sales = &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;HASONEVALUE&lt;/SPAN&gt;&lt;SPAN&gt;('Table'[Table]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Switch&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;True&lt;/SPAN&gt;&lt;SPAN&gt;(),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Values&lt;/SPAN&gt;&lt;SPAN&gt;('Table'[Table]) =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"Revenue"&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp;&amp;amp; [Rev LW]&amp;lt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;FORMAT&lt;/SPAN&gt;&lt;SPAN&gt; ([Rev LW], &lt;/SPAN&gt;&lt;SPAN&gt;"$#,###"&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Values&lt;/SPAN&gt;&lt;SPAN&gt;('Table'[Rev/Units]) =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"Units"&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp;&amp;amp; [Units LW]&amp;lt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;FORMAT&lt;/SPAN&gt;&lt;SPAN&gt;([Units LW], &lt;/SPAN&gt;&lt;SPAN&gt;"0"&lt;/SPAN&gt;&lt;SPAN&gt;)),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;[Units LW])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Can anyone give me any ideas on how best to tackle this,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/DIV&gt;</description>
    <pubDate>Sat, 17 Sep 2022 12:54:39 GMT</pubDate>
    <dc:creator>StuBee</dc:creator>
    <dc:date>2022-09-17T12:54:39Z</dc:date>
    <item>
      <title>Switch Table Custom Format failing to sort data correctly</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Switch-Table-Custom-Format-failing-to-sort-data-correctly/m-p/2775011#M86594</link>
      <description>&lt;DIV&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;When I use a custom format on my data, the data gets sorted based on the first number as shown below.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code I am using, I have tried with max instead of values and without stating that it can't be 0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also have used the "Currency" option, however this put all the negative numbers at the top of the list as they where in ().&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Sales = &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;HASONEVALUE&lt;/SPAN&gt;&lt;SPAN&gt;('Table'[Table]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Switch&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;True&lt;/SPAN&gt;&lt;SPAN&gt;(),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Values&lt;/SPAN&gt;&lt;SPAN&gt;('Table'[Table]) =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"Revenue"&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp;&amp;amp; [Rev LW]&amp;lt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;FORMAT&lt;/SPAN&gt;&lt;SPAN&gt; ([Rev LW], &lt;/SPAN&gt;&lt;SPAN&gt;"$#,###"&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Values&lt;/SPAN&gt;&lt;SPAN&gt;('Table'[Rev/Units]) =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"Units"&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp;&amp;amp; [Units LW]&amp;lt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;FORMAT&lt;/SPAN&gt;&lt;SPAN&gt;([Units LW], &lt;/SPAN&gt;&lt;SPAN&gt;"0"&lt;/SPAN&gt;&lt;SPAN&gt;)),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;[Units LW])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Can anyone give me any ideas on how best to tackle this,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 17 Sep 2022 12:54:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Switch-Table-Custom-Format-failing-to-sort-data-correctly/m-p/2775011#M86594</guid>
      <dc:creator>StuBee</dc:creator>
      <dc:date>2022-09-17T12:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: Switch Table Custom Format failing to sort data correctly</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Switch-Table-Custom-Format-failing-to-sort-data-correctly/m-p/2775719#M86652</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="198613" data-lia-user-login="StuBee" class="lia-mention lia-mention-user"&gt;StuBee&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's a bad idea, indeed, to format a numeric measure with FORMAT and return a string (unless you need to incorporate such a value into some kind of text but even then you create a version of the measure). Such "values" will always be sorted as strings, not numbers. That's one thing. A measure should always return the raw value (always of the same type). Mixing floats with integers is a NO-NO. Measures should be consistent. Otherwise you'll be facing issues. And, as we see, you do. Formatting a measure should be done in the UI option in the ribbon. So, if you have a measure that wants to return different types of info, you're most likely doing it wrong. You should rethink the design.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Sep 2022 10:03:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Switch-Table-Custom-Format-failing-to-sort-data-correctly/m-p/2775719#M86652</guid>
      <dc:creator>daXtreme</dc:creator>
      <dc:date>2022-09-18T10:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: Switch Table Custom Format failing to sort data correctly</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Switch-Table-Custom-Format-failing-to-sort-data-correctly/m-p/2780336#M86980</link>
      <description>&lt;P&gt;Ahh ok, so is there no good way to use a switch function to return a whole number and switch to currency?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That's fine, they can see it is revenue from the box they click can't they.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks, you confirmed what I was hoping wasn't the case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2022 10:08:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Switch-Table-Custom-Format-failing-to-sort-data-correctly/m-p/2780336#M86980</guid>
      <dc:creator>StuBee</dc:creator>
      <dc:date>2022-09-20T10:08:48Z</dc:date>
    </item>
  </channel>
</rss>

