<?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: Dynamic formatting for negative values in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-formatting-for-negative-values/m-p/4400368#M174697</link>
    <description>&lt;P&gt;Hi Owen,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank-you so much for this solution. Worked perfectly for what I was trying to show in my pbix. I am still new to the absolute conditions piece and will be studying up as suggested on how to you utilizate absolutes within my dax.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Feb 2025 15:52:04 GMT</pubDate>
    <dc:creator>bbass82</dc:creator>
    <dc:date>2025-02-07T15:52:04Z</dc:date>
    <item>
      <title>Dynamic formatting for negative values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-formatting-for-negative-values/m-p/4395012#M174494</link>
      <description>&lt;P&gt;Hello Community friends,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Was hoping someone could help me with this issue I am having in regards to dynamic formatting of my values in my DAX. I have some negative values that I want to show in the same format (no negative values in other columns).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;I wrote the below DAX in hopes of returning values with the below formatting:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1) Show all negative #'s equal to or greater than -$1,000,000 as formatting of "-$1.0M"&lt;/P&gt;&lt;P&gt;2) Show all negative #'s between -$999,999k to -$0k as formatting of "-$999.9k"&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Current State:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help with this is greatly appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;Brandon Bassett&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2025 19:42:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-formatting-for-negative-values/m-p/4395012#M174494</guid>
      <dc:creator>bbass82</dc:creator>
      <dc:date>2025-02-04T19:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic formatting for negative values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-formatting-for-negative-values/m-p/4395094#M174498</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="748579" data-lia-user-login="bbass82" class="lia-mention lia-mention-user"&gt;bbass82&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you just need to add one condition within SWITCH to your current expression to handle negative numbers between -1m and zero.&lt;/P&gt;
&lt;P&gt;I would write the overall expression like this with SELECTEDMEASURE assigned to a variable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;VAR MeasureValue = SELECTEDMEASURE ( )
VAR Result =
    SWITCH (
        TRUE ( ),
        MeasureValue &amp;lt; -1e6, "$#,##0,,.0M",
        MeasureValue &amp;lt; 0, "$#,##0,.0k", -- new condition
        MeasureValue &amp;lt; 1e3, "$#,##0",
        MeasureValue &amp;lt; 1e6, "$#,##0,.0k",
        -- Otherwise &amp;gt;= 1e6
        "$#,##0,,.0M"
    )
RETURN
    Result&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PBIX attached in case that helps debug.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;You could consider using conditions based on &lt;STRONG&gt;ABS ( SELECTEDMEASURE () )&lt;/STRONG&gt; if the same format string applies to positive/negative values in the same absolute value range.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you able to get it working at your end?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;Owen&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2025 22:01:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-formatting-for-negative-values/m-p/4395094#M174498</guid>
      <dc:creator>OwenAuger</dc:creator>
      <dc:date>2025-02-04T22:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic formatting for negative values</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-formatting-for-negative-values/m-p/4400368#M174697</link>
      <description>&lt;P&gt;Hi Owen,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank-you so much for this solution. Worked perfectly for what I was trying to show in my pbix. I am still new to the absolute conditions piece and will be studying up as suggested on how to you utilizate absolutes within my dax.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2025 15:52:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dynamic-formatting-for-negative-values/m-p/4400368#M174697</guid>
      <dc:creator>bbass82</dc:creator>
      <dc:date>2025-02-07T15:52:04Z</dc:date>
    </item>
  </channel>
</rss>

