<?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 Dax in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-Dax/m-p/3880417#M151476</link>
    <description>&lt;P&gt;I am not alowed to upload a pbix. So please follow the instructions below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Create the date table in Power query using the link I sent. Choose full years for the data to be generated&lt;/P&gt;&lt;P&gt;2. Mark the table as date table&lt;/P&gt;&lt;P&gt;3. Create a relationship between Dates Date and Month in your data table&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4. Create a new measure DAX with the code provided&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;Matrix Object Color = 

VAR _CurrentMonthResult = SUM(DataConD[Value])
VAR _PrevPer = SELECTEDVALUE(Dates[CurrMonthOffset]) - 1
VAR _PreviousMonthResult = 
    CALCULATE(
        SUM(DataConD[Value]), 
              FILTER(ALL(Dates),
               Dates[CurrMonthOffset] = _PrevPer)
               )
VAR _Result = IF(_CurrentMonthResult &amp;lt; _PreviousMonthResult, "#F6EEEF", "#F0F6EE")

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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;5. Create a matrix as below&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;6. Apply conditional format based on the measure DAX (right click on Values - cond format - background color)&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&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;7. Mark my answer as the solution. Thanks!&lt;/P&gt;</description>
    <pubDate>Tue, 30 Apr 2024 18:32:04 GMT</pubDate>
    <dc:creator>Alex87</dc:creator>
    <dc:date>2024-04-30T18:32:04Z</dc:date>
    <item>
      <title>Conditional Formatting Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-Dax/m-p/3868834#M151138</link>
      <description>&lt;P&gt;I know there is a lot of stuff out there about this but I have been going at it for ages and still can't figure it out.&lt;BR /&gt;I am trying to compare each months count with the previous month. I want to colour the background red if the count in month was less than previous and green if the count was greater than the previous month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this measure:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;but it just has an output matrix:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2024 15:53:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-Dax/m-p/3868834#M151138</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-04-25T15:53:27Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Formatting Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-Dax/m-p/3869234#M151147</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I reproduced your usecase&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The formula I used for conditional formatting is the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Matrix Object Color =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;_CurrentMonthResult&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;DataConD&lt;/SPAN&gt;&lt;SPAN&gt;[Value]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;_PrevPer&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;SELECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Dates&lt;/SPAN&gt;&lt;SPAN&gt;[CurrMonthOffset]&lt;/SPAN&gt;&lt;SPAN&gt;) - &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;_PreviousMonthResult&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;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;SUM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reviousMonthResult&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"#F6EEEF"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"#F0F6EE"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;_Result&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Replace the sum of value from my example with the count of ids as in your datasource and it should work.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;If it does work, do not forget to mark my post as a solution. Thanks!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 25 Apr 2024 19:51:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-Dax/m-p/3869234#M151147</guid>
      <dc:creator>Alex87</dc:creator>
      <dc:date>2024-04-25T19:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Formatting Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-Dax/m-p/3871231#M151227</link>
      <description>&lt;P&gt;Thank you for your repsonse! I am still getting the same output as before.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created a column in my date table with Current Month Offset as that is what I thought you did above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;And this is my new measure:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know why this is happeneing?&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 13:36:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-Dax/m-p/3871231#M151227</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-04-26T13:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Formatting Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-Dax/m-p/3871632#M151243</link>
      <description>&lt;P&gt;You need to use a proper date calendar. the Month offset you created is not good.&lt;/P&gt;&lt;P&gt;I recommend using Melissa's PQ date table, by far the most adanced calendar table out there.&lt;/P&gt;&lt;P&gt;&lt;A href="https://forum.enterprisedna.co/t/extended-date-table-power-query-m-function/6390" target="_blank"&gt;Extended Date Table (Power Query M function) - Power Query / M Code Showcase - Enterprise DNA Forum&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For info, my month offset looks like this:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 17:51:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-Dax/m-p/3871632#M151243</guid>
      <dc:creator>Alex87</dc:creator>
      <dc:date>2024-04-26T17:51:29Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Formatting Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-Dax/m-p/3877733#M151400</link>
      <description>&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;If these also don't help, please share more detailed information and description to help us clarify your scenario to test.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;&lt;A href="http://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;How to Get Your Question Answered Quickly&amp;nbsp;&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Xiaoxin Sheng&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2024 05:11:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-Dax/m-p/3877733#M151400</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-04-30T05:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Formatting Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-Dax/m-p/3879723#M151458</link>
      <description>&lt;P&gt;I am still getting the same result.&amp;nbsp;&lt;BR /&gt;I have now created a date table as you suggested and have created a link in the data model between the date table and table I am visualising in the matrix. I can't think of what could be the problem. Do you have any thoughts?&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2024 13:41:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-Dax/m-p/3879723#M151458</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-04-30T13:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Formatting Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-Dax/m-p/3880126#M151471</link>
      <description>&lt;P&gt;did you create the date table starting the first day of the year until the last day of the year? did you create relationship based on day date? I will sent you my pbix in the next couple of hours if you still can't solve the issue&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2024 16:01:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-Dax/m-p/3880126#M151471</guid>
      <dc:creator>Alex87</dc:creator>
      <dc:date>2024-04-30T16:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Formatting Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-Dax/m-p/3880417#M151476</link>
      <description>&lt;P&gt;I am not alowed to upload a pbix. So please follow the instructions below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Create the date table in Power query using the link I sent. Choose full years for the data to be generated&lt;/P&gt;&lt;P&gt;2. Mark the table as date table&lt;/P&gt;&lt;P&gt;3. Create a relationship between Dates Date and Month in your data table&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4. Create a new measure DAX with the code provided&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;Matrix Object Color = 

VAR _CurrentMonthResult = SUM(DataConD[Value])
VAR _PrevPer = SELECTEDVALUE(Dates[CurrMonthOffset]) - 1
VAR _PreviousMonthResult = 
    CALCULATE(
        SUM(DataConD[Value]), 
              FILTER(ALL(Dates),
               Dates[CurrMonthOffset] = _PrevPer)
               )
VAR _Result = IF(_CurrentMonthResult &amp;lt; _PreviousMonthResult, "#F6EEEF", "#F0F6EE")

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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;5. Create a matrix as below&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;6. Apply conditional format based on the measure DAX (right click on Values - cond format - background color)&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&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;7. Mark my answer as the solution. Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2024 18:32:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-Dax/m-p/3880417#M151476</guid>
      <dc:creator>Alex87</dc:creator>
      <dc:date>2024-04-30T18:32:04Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Formatting Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-Dax/m-p/3882241#M151522</link>
      <description>&lt;P&gt;I am still getting the same result, which is a table full of green values. I followed your steps from creating a scratch report too. Not sure why this isn't working.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The join between the Date table and my data table is probably the sticking point. What data type is your month?&lt;BR /&gt;&lt;BR /&gt;When I create a table with just the dates, I get this: (where Date is the column in the date table and the other three columns are from my data table)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2024 10:31:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-Dax/m-p/3882241#M151522</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-01T10:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Formatting Dax</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-Dax/m-p/3882426#M151528</link>
      <description>&lt;P&gt;Relationships have the same data type, which is Date.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2024 11:25:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-Formatting-Dax/m-p/3882426#M151528</guid>
      <dc:creator>Alex87</dc:creator>
      <dc:date>2024-05-01T11:25:10Z</dc:date>
    </item>
  </channel>
</rss>

