<?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: Rolling Sum that Uses a Variable Factor in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Sum-that-Uses-a-Variable-Factor/m-p/2737487#M83981</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="418667" data-lia-user-login="Brotedo" class="lia-mention lia-mention-user"&gt;Brotedo&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe you can try this.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
VAR _currentmonth =
    SELECTEDVALUE ( Parameter[Parameter] )
VAR _f =
    ADDCOLUMNS (
        'factors',
        "sales1",
            CALCULATE (
                SUM ( sales[Sales] ),
                FILTER (
                    'sales',
                    [MonthIndex]
                        = EARLIER ( [MonthsFromCurrent] ) + _currentmonth
                )
            ) * [Factor]
    )
RETURN
    SUMX ( _f, [sales1] )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Pbix in the end you can refer.&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Community Support Team _ chenwu zhu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 31 Aug 2022 08:35:43 GMT</pubDate>
    <dc:creator>v-chenwuz-msft</dc:creator>
    <dc:date>2022-08-31T08:35:43Z</dc:date>
    <item>
      <title>Rolling Sum that Uses a Variable Factor</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Sum-that-Uses-a-Variable-Factor/m-p/2729269#M83531</link>
      <description>&lt;P&gt;I have a monthly sales dataset, like this:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;MonthIndex&lt;/TD&gt;&lt;TD&gt;Sales&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;45&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;55&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;45&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;70&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;8&lt;/TD&gt;&lt;TD&gt;60&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;10&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;55&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;11&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;And I have a table of factors, like this:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;MonthsFromCurrent&lt;/TD&gt;&lt;TD&gt;Factor&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;.7&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;.5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;.2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;.06&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;I need a measure that, for the given month, calculates the sum of the products of the sales and factors. For example, if the current month is 6, I want the measure to output (40*.7 + 70*.5 + 60*.2 + 50*.06) = 78&amp;nbsp;&lt;/P&gt;&lt;P&gt;The factor for all other months is 0.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 15:34:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Sum-that-Uses-a-Variable-Factor/m-p/2729269#M83531</guid>
      <dc:creator>Brotedo</dc:creator>
      <dc:date>2022-08-26T15:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling Sum that Uses a Variable Factor</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Sum-that-Uses-a-Variable-Factor/m-p/2729677#M83549</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="418667" data-lia-user-login="Brotedo" class="lia-mention lia-mention-user"&gt;Brotedo&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please try&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;NewMeasure =
SUMX (
    FILTER (
        ALLSELECTED ( Sales ),
        Sales[MonthIndex] &amp;gt;= MAX ( Sales[MonthIndex] )
            &amp;amp;&amp;amp; Sales[MonthIndex]
                &amp;lt; MAX ( Sales[MonthIndex] ) + COUNTROWS ( Factors )
    ),
    SUMX (
        FILTER ( Factors, Factors[MonthsFromCurrent] = Sales[MonthIndex] ),
        Sales[Sales] * Factors[Factor]
    )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 26 Aug 2022 19:31:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Sum-that-Uses-a-Variable-Factor/m-p/2729677#M83549</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-08-26T19:31:29Z</dc:date>
    </item>
    <item>
      <title>Re: Rolling Sum that Uses a Variable Factor</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Sum-that-Uses-a-Variable-Factor/m-p/2737487#M83981</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="418667" data-lia-user-login="Brotedo" class="lia-mention lia-mention-user"&gt;Brotedo&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe you can try this.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
VAR _currentmonth =
    SELECTEDVALUE ( Parameter[Parameter] )
VAR _f =
    ADDCOLUMNS (
        'factors',
        "sales1",
            CALCULATE (
                SUM ( sales[Sales] ),
                FILTER (
                    'sales',
                    [MonthIndex]
                        = EARLIER ( [MonthsFromCurrent] ) + _currentmonth
                )
            ) * [Factor]
    )
RETURN
    SUMX ( _f, [sales1] )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Pbix in the end you can refer.&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Community Support Team _ chenwu zhu&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 08:35:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rolling-Sum-that-Uses-a-Variable-Factor/m-p/2737487#M83981</guid>
      <dc:creator>v-chenwuz-msft</dc:creator>
      <dc:date>2022-08-31T08:35:43Z</dc:date>
    </item>
  </channel>
</rss>

