<?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 on the X-axis in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-formatting-on-the-X-axis/m-p/3527474#M135540</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="460868" data-lia-user-login="FreemanZ" class="lia-mention lia-mention-user"&gt;FreemanZ&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That has worked perfectly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Fri, 10 Nov 2023 10:29:25 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-11-10T10:29:25Z</dc:date>
    <item>
      <title>Conditional formatting on the X-axis</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-formatting-on-the-X-axis/m-p/3525597#M135458</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to do a report that will automatically update at the start of each month. Within this report there are some charts, like the one attached.&amp;nbsp;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the graph selected i want it to match the legend below using conditional formatting. This is because every month i want the colour to remain the same, whereby the earliest month in the data set is orange, the latest month in the data set is blue and the other month is black. I have been finding it difficult to write the correct DAX that will do this. Is it possible or is there perhaps a way to work around it. I am also attaching two more screenshots if they help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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 would be appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Luke&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2023 15:10:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-formatting-on-the-X-axis/m-p/3525597#M135458</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-11-09T15:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional formatting on the X-axis</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-formatting-on-the-X-axis/m-p/3525665#M135460</link>
      <description>&lt;P&gt;hello&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you could try to create a measure that forms the conditional formatting for you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;measure = if( AND([month] = 9, [year] = 2022), "orange", if(AND([month] = 9, [year] = 2023),"blue","black"))&lt;BR /&gt;&lt;BR /&gt;then add this measure in the fx color setting in your bar as a field value option and you will get the colors for each legend&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2023 15:42:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-formatting-on-the-X-axis/m-p/3525665#M135460</guid>
      <dc:creator>eliasayyy</dc:creator>
      <dc:date>2023-11-09T15:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional formatting on the X-axis</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-formatting-on-the-X-axis/m-p/3525746#M135466</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="434309" data-lia-user-login="eliasayyy" class="lia-mention lia-mention-user"&gt;eliasayyy&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need a measure that will still work without me having to go in and change anything when the data automatically updates at the start of each month. for example the most recent months report is October (10)&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2023 16:08:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-formatting-on-the-X-axis/m-p/3525746#M135466</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-11-09T16:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional formatting on the X-axis</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-formatting-on-the-X-axis/m-p/3526643#M135510</link>
      <description>&lt;P&gt;hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure if i fully get you. Supposing you have a data table like:&lt;/P&gt;
&lt;TABLE width="132"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="68"&gt;date&lt;/TD&gt;
&lt;TD width="64"&gt;amt&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;12/1/2022&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;12/2/2022&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1/1/2023&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1/2/2023&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2/1/2023&lt;/TD&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2/2/2023&lt;/TD&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;3/1/2023&lt;/TD&gt;
&lt;TD&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;3/2/2023&lt;/TD&gt;
&lt;TD&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;4/1/2023&lt;/TD&gt;
&lt;TD&gt;5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;4/2/2023&lt;/TD&gt;
&lt;TD&gt;5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;5/1/2023&lt;/TD&gt;
&lt;TD&gt;6&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;5/2/2023&lt;/TD&gt;
&lt;TD&gt;6&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&lt;BR /&gt;Try to&lt;/P&gt;
&lt;P&gt;1) create a calculated&amp;nbsp;dates table like below and connect with data[date].&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;dates = 
ADDCOLUMNS(
    CALENDAR(MIN(data[date]), MAX(data[date])),
    "YYMM", FORMAT([Date], "yy/mm")
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) create another calculated slicer table like below and keep it unrelated:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;slicer = dates&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) plot a slicer with slicer[date] column;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4) plot a column chart with dates[yymm] and data[amt] column, and apply conditional formatting for the column color with a measure like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Color = 
VAR _minsliceddate = MIN(slicer[date])
VAR _maxsliceddate = MAX(slicer[date])
VAR _minslicedmonth = YEAR(_minsliceddate)*12+MONTH(_minsliceddate)
VAR _maxslicedmonth = YEAR(_maxsliceddate)*12+MONTH(_maxsliceddate)
VAR _currentdate = MAX(dates[date])
VAR _currentmonth = YEAR(_currentdate)*12+MONTH(_currentdate)
VAR _result =
SWITCH(
    TRUE(),
    _currentmonth =_minslicedmonth, "Orange",
    _currentmonth=_maxslicedmonth, "Blue",
   _currentmonth=_maxslicedmonth-1, "Black",
    "Gray"
)
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;it worked like:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2023 02:30:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-formatting-on-the-X-axis/m-p/3526643#M135510</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-11-10T02:30:57Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional formatting on the X-axis</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-formatting-on-the-X-axis/m-p/3527474#M135540</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="460868" data-lia-user-login="FreemanZ" class="lia-mention lia-mention-user"&gt;FreemanZ&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That has worked perfectly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2023 10:29:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Conditional-formatting-on-the-X-axis/m-p/3527474#M135540</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-11-10T10:29:25Z</dc:date>
    </item>
  </channel>
</rss>

