<?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 Dax formula for creating rolling months with condition in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-formula-for-creating-rolling-months-with-condition/m-p/3028665#M103391</link>
    <description>&lt;P&gt;Hi Everyone&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to create a &lt;STRONG&gt;Rolling Month&lt;/STRONG&gt; field in DAX with a condition. Note: the examples below are the screenshots from Excel to show what output I want to get in Power BI. Hope it is clear &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The conditon is described below:&lt;/P&gt;&lt;P&gt;When the field &lt;STRONG&gt;Aligned&lt;/STRONG&gt; is filtered to No, then the Rolling Month is calculated for each country for the most current available month. It is shown below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;When field is filtered to "Yes" then it is aligning all fields to the month where Sales are available and calculating month accordingly. You may see below an example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I also attached the PBIX file, where you can check details:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Any help much appreciated, thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Link to the PBIX file is here:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/drive/folders/1CGU2XIhiC2K2kWd9984tTxbWmX3G42uA?usp=share_link" target="_blank"&gt;https://drive.google.com/drive/folders/1CGU2XIhiC2K2kWd9984tTxbWmX3G42uA?usp=share_link&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Matias&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 18 Jan 2023 12:58:44 GMT</pubDate>
    <dc:creator>maatiash</dc:creator>
    <dc:date>2023-01-18T12:58:44Z</dc:date>
    <item>
      <title>Dax formula for creating rolling months with condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-formula-for-creating-rolling-months-with-condition/m-p/3028665#M103391</link>
      <description>&lt;P&gt;Hi Everyone&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to create a &lt;STRONG&gt;Rolling Month&lt;/STRONG&gt; field in DAX with a condition. Note: the examples below are the screenshots from Excel to show what output I want to get in Power BI. Hope it is clear &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The conditon is described below:&lt;/P&gt;&lt;P&gt;When the field &lt;STRONG&gt;Aligned&lt;/STRONG&gt; is filtered to No, then the Rolling Month is calculated for each country for the most current available month. It is shown below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;When field is filtered to "Yes" then it is aligning all fields to the month where Sales are available and calculating month accordingly. You may see below an example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I also attached the PBIX file, where you can check details:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Any help much appreciated, thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Link to the PBIX file is here:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/drive/folders/1CGU2XIhiC2K2kWd9984tTxbWmX3G42uA?usp=share_link" target="_blank"&gt;https://drive.google.com/drive/folders/1CGU2XIhiC2K2kWd9984tTxbWmX3G42uA?usp=share_link&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Matias&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 12:58:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-formula-for-creating-rolling-months-with-condition/m-p/3028665#M103391</guid>
      <dc:creator>maatiash</dc:creator>
      <dc:date>2023-01-18T12:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: Dax formula for creating rolling months with condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-formula-for-creating-rolling-months-with-condition/m-p/3030403#M103534</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="450293" data-lia-user-login="maatiash" class="lia-mention lia-mention-user"&gt;maatiash&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can create a mesure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Rolling month = "M"&amp;amp;COUNTROWS(FILTER(ALLSELECTED(CountryData),[Country]=MAX([Country])&amp;amp;&amp;amp;MONTH(CountryData[Reporting Date])&amp;gt;=MONTH(MAX([Reporting Date]))))

&lt;/LI-CODE&gt;
&lt;P&gt;and set the following filter in visual filter:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards!&lt;/P&gt;
&lt;P&gt;Yolo Zhu&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If this post&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;, then please consider&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 06:25:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-formula-for-creating-rolling-months-with-condition/m-p/3030403#M103534</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-19T06:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: Dax formula for creating rolling months with condition</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-formula-for-creating-rolling-months-with-condition/m-p/3030922#M103573</link>
      <description>&lt;P&gt;Hi Yolo,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help! Please let me to test, so I'll let you know if it works &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Matias&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 10:47:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Dax-formula-for-creating-rolling-months-with-condition/m-p/3030922#M103573</guid>
      <dc:creator>maatiash</dc:creator>
      <dc:date>2023-01-19T10:47:13Z</dc:date>
    </item>
  </channel>
</rss>

