<?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 add Color using If Statement in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-Color-using-If-Statement/m-p/2390101#M62121</link>
    <description>&lt;P&gt;My dax forumla is&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Outlier = if ([Value] &amp;gt;= [%75] , "Yes" , "NO" )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[%75] is a calculated measure.&amp;nbsp; what i want is if it yes let the color be Red and if it not let the color be Green.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is that even possible?&lt;/P&gt;</description>
    <pubDate>Sat, 12 Mar 2022 20:23:14 GMT</pubDate>
    <dc:creator>SalmanABDul_97</dc:creator>
    <dc:date>2022-03-12T20:23:14Z</dc:date>
    <item>
      <title>How to add Color using If Statement</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-Color-using-If-Statement/m-p/2390101#M62121</link>
      <description>&lt;P&gt;My dax forumla is&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Outlier = if ([Value] &amp;gt;= [%75] , "Yes" , "NO" )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[%75] is a calculated measure.&amp;nbsp; what i want is if it yes let the color be Red and if it not let the color be Green.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is that even possible?&lt;/P&gt;</description>
      <pubDate>Sat, 12 Mar 2022 20:23:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-Color-using-If-Statement/m-p/2390101#M62121</guid>
      <dc:creator>SalmanABDul_97</dc:creator>
      <dc:date>2022-03-12T20:23:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to add Color using If Statement</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-Color-using-If-Statement/m-p/2390431#M62144</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="364241" data-lia-user-login="SalmanABDul_97" class="lia-mention lia-mention-user"&gt;SalmanABDul_97&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As of my knowledge PBI does not know how to colour code on string values. However, it works just fine if you can provide numbers. So a quick way could be to rewrite your measure like this&lt;/P&gt;&lt;PRE&gt;OutlierColourCoding = if ([Value] &amp;gt;= [%75] , 1 , 0 )&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, use it in the conditional formate pane with this settings:&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;&lt;P&gt;Another way which I personally start to enjoy more and more is to build the colorcodemeasure like this:&lt;/P&gt;&lt;PRE&gt;OutlierColourCoding = if ([Value] &amp;gt;= [%75] , "green" , "red" )&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or you specify the exact color in Hex:&lt;/P&gt;&lt;PRE&gt;OutlierColourCoding = if ([Value] &amp;gt;= [%75] , "#ff0000" , "#66ff33" )&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then you can choose the measure directly to do all the color coding for you:&lt;/P&gt;&lt;P class="lia-align-center"&gt;&lt;img /&gt;&lt;/P&gt;&lt;P class="lia-align-center"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;It goes a lot quicker to set up your color coding on different spots in your report. However, since you are hardcoding the color per value, you are less flexible if you would like to use different colors in different contexts&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;Does this help? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-justify"&gt;/Tom&lt;BR /&gt;&lt;A href="https://www.tackytech.blog/" target="_blank"&gt;https://www.tackytech.blog/&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://www.instagram.com/tackytechtom/" target="_blank"&gt;https://www.instagram.com/tackytechtom/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Mar 2022 10:16:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-Color-using-If-Statement/m-p/2390431#M62144</guid>
      <dc:creator>tackytechtom</dc:creator>
      <dc:date>2022-03-13T10:16:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to add Color using If Statement</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-Color-using-If-Statement/m-p/2394088#M62386</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="364241" data-lia-user-login="SalmanABDul_97" class="lia-mention lia-mention-user"&gt;SalmanABDul_97&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;We can make the problem simple with another expression. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;When the value is greater than or equal to 75% , return Red . If the value is less than 75% , return Green . Then we can create a measure to return colors .&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Outlier = IF([Value]&amp;gt;=0.75,"Red","Green")&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;Then set conditional formatting for [Value] . Apply measure [Outlier] for [Value] .&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The final result is as shown :&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I have attached my pbix file , you can refer to it .&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Community Support Team _ Ailsa Tao&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2022 06:13:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-add-Color-using-If-Statement/m-p/2394088#M62386</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-03-15T06:13:00Z</dc:date>
    </item>
  </channel>
</rss>

