<?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: Need help on conditional format previous week sales in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-on-conditional-format-previous-week-sales/m-p/1493273#M28737</link>
    <description>&lt;P&gt;Hi Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you asking how to build the measure or how to display the arrows? Or both?&lt;/P&gt;
&lt;P&gt;For the measure try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Icon =
VAR currentWeekVal_ =
    CALCULATE ( SUM ( Datagrunnlag[Antall solgt] ) )
VAR previousWeekVal_ =
    CALCULATE (
        SUM ( Datagrunnlag[Antall solgt] ),
        FILTER (
            ALL ( Datagrunnlag[Week number] ),
            Datagrunnlag[Week number]
                = MAX ( Datagrunnlag[Week number] ) - 1
        )
    )
VAR _val = currentWeekVal_ - previousWeekVal_
RETURN
    SWITCH ( TRUE (), _val &amp;lt; 0, -1, _val = 0, 0, _val &amp;gt; 0, 1 )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Nov 2020 16:37:20 GMT</pubDate>
    <dc:creator>AlB</dc:creator>
    <dc:date>2020-11-13T16:37:20Z</dc:date>
    <item>
      <title>Need help on conditional format previous week sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-on-conditional-format-previous-week-sales/m-p/1492960#M28716</link>
      <description>&lt;P&gt;Hi, I want this table to show icons (arrows up, down or equal) if the previous week sales is higher, lower or equal to the sales of the week of that column. Eg: Sales of "boller" in week 43 is higher than in week 42, thus must the arrow point upwards. The other way around for sales of Brød in week 43, that should be downward.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my DAX code:&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Icon = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR _val =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE ( &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SUM ( Datagrunnlag[Antall solgt]))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;-&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SUM (Datagrunnlag[Antall solgt]),Datagrunnlag,Datagrunnlag[Week number]-1)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SWITCH ( TRUE (),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;_val &amp;lt; 0, -1, &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;_val = 0, 0,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;_val &amp;gt; 0, 1 )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;then i use conditional formatting based on rule "Icon"&lt;/DIV&gt;&lt;DIV&gt;e&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2020 13:35:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-on-conditional-format-previous-week-sales/m-p/1492960#M28716</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-13T13:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: Need help on conditional format previous week sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-on-conditional-format-previous-week-sales/m-p/1493009#M28718</link>
      <description>&lt;P&gt;Let us make it simple .&lt;/P&gt;&lt;P&gt;Use 2 variables.&lt;/P&gt;&lt;P&gt;One for current week and for that use max .&lt;/P&gt;&lt;P&gt;var 2 will have sum with MAX(column name)-1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now use the calculation in&amp;nbsp; switch statement.&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2020 14:04:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-on-conditional-format-previous-week-sales/m-p/1493009#M28718</guid>
      <dc:creator>kumar27</dc:creator>
      <dc:date>2020-11-13T14:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: Need help on conditional format previous week sales</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-on-conditional-format-previous-week-sales/m-p/1493273#M28737</link>
      <description>&lt;P&gt;Hi Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you asking how to build the measure or how to display the arrows? Or both?&lt;/P&gt;
&lt;P&gt;For the measure try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Icon =
VAR currentWeekVal_ =
    CALCULATE ( SUM ( Datagrunnlag[Antall solgt] ) )
VAR previousWeekVal_ =
    CALCULATE (
        SUM ( Datagrunnlag[Antall solgt] ),
        FILTER (
            ALL ( Datagrunnlag[Week number] ),
            Datagrunnlag[Week number]
                = MAX ( Datagrunnlag[Week number] ) - 1
        )
    )
VAR _val = currentWeekVal_ - previousWeekVal_
RETURN
    SWITCH ( TRUE (), _val &amp;lt; 0, -1, _val = 0, 0, _val &amp;gt; 0, 1 )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2020 16:37:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Need-help-on-conditional-format-previous-week-sales/m-p/1493273#M28737</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2020-11-13T16:37:20Z</dc:date>
    </item>
  </channel>
</rss>

