<?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: Power BI Slicers - Default Year / Month / Day – First Day of the Month Issue in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Power-BI-Slicers-Default-Year-Month-Day-First-Day-of-the-Month/m-p/4634378#M177411</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="876325" data-lia-user-login="danvrabie" class="lia-mention lia-mention-user"&gt;danvrabie&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for reaching out to Microsoft Fabric Community.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The problem with the initial CurrentMonth Measure was that it directly compared the difference between each date in the Calendar table and the current date using DATEDIFF. When today is the 1st of the month, this comparison would return 0, indicating that it's still within the same month. But for your business logic, you actually wanted the previous month (March) to be labeled as "This Month" when it's the 1st of April, rather than showing April itself.&lt;BR /&gt;To address this, we revised the DAX by adding a check for the first day of the month. If it's the 1st of the month, the formula displays the previous month (March) as "This Month." Otherwise, it follows the original logic of showing the current month.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here’s the revised DAX formula for the CurrentMonth column:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CurrentMonth =&amp;nbsp;&lt;BR /&gt;VAR __current_date = UTCNOW() - (3 / 24)&lt;BR /&gt;VAR __is_first_of_month = DAY(__current_date) = 1&lt;BR /&gt;VAR __dif_month = DATEDIFF('Calendar'[Date], __current_date, MONTH)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;RETURN&lt;BR /&gt;IF(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; __is_first_of_month,&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(__dif_month = -1, "This Month", FORMAT('Calendar'[Date], "MMMM")),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(__dif_month = 0, "This Month", FORMAT('Calendar'[Date], "MMMM"))&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;helps, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;STRONG&gt;Accepting as solution&amp;nbsp;&lt;/STRONG&gt;to help the other members find it more quickly,&amp;nbsp;don't forget to give a&amp;nbsp;&lt;STRONG&gt;"Kudos"&lt;/STRONG&gt;&amp;nbsp;– I’d truly appreciate it!&amp;nbsp;&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;Anjan Kumar Chippa&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Apr 2025 06:42:30 GMT</pubDate>
    <dc:creator>v-achippa</dc:creator>
    <dc:date>2025-04-02T06:42:30Z</dc:date>
    <item>
      <title>Power BI Slicers - Default Year / Month / Day – First Day of the Month Issue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Power-BI-Slicers-Default-Year-Month-Day-First-Day-of-the-Month/m-p/4633902#M177398</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created a default slicer selection for Power BI, by creating 3 columns in a Calendar Table, as follows:&lt;/P&gt;&lt;P&gt;CurrentYear =&lt;/P&gt;&lt;P&gt;VAR __dif_year = DATEDIFF('Calendar'[Date],UTCNOW()-(3/24),YEAR)&lt;/P&gt;&lt;P&gt;return&lt;/P&gt;&lt;P&gt;IF(__dif_year = 0, "This Year", IF(__dif_year &amp;gt;0, FORMAT('Calendar'[Date],"YYYY")))&lt;BR /&gt;&lt;BR /&gt;CurrentMonth =&lt;/P&gt;&lt;P&gt;VAR __dif_month = DATEDIFF('Calendar'[Date],UTCNOW()-(3/24),MONTH)&lt;/P&gt;&lt;P&gt;return&lt;/P&gt;&lt;P&gt;IF(__dif_month = 0, "This Month", IF(__dif_month &amp;gt;0, FORMAT('Calendar'[Date],"MMMM")))&lt;/P&gt;&lt;P&gt;CurrentDate =&lt;/P&gt;&lt;P&gt;VAR __dif_day = DATEDIFF('Calendar'[Date],UTCNOW()-(3/24),DAY)&lt;/P&gt;&lt;P&gt;return&lt;/P&gt;&lt;P&gt;IF(__dif_day = 1, "Yesterday", IF(__dif_day &amp;gt;0, FORMAT('Calendar'[Date],"YYYY-MM-DD")))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each dashboard page has 3 slicers: CurrentYear: “This Year”, CurrentMonth: “This Month”, CurrentDate: “Yesterday”, which filters the dashboard values as of yesterday.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The complication I’m running into is the first of each month, when Current Month = “This month” returns the current month, while CurrentDate = “Yesterday” returns the date from the previous month. For example, on April 1st, the Month slicer should return April values, while the Date slicer should return March 31st values. Given the conflict between the Month Slicer and the Date Slicer, no values are returned.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way I can define the CurrentMonth calculation / slicer so that:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If the current date is the first of the month, the previous month is labelled “This Month”&lt;/LI&gt;&lt;LI&gt;If the current date is not the first of the month, the current month is labelled “This Month”?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Link to mockup file here: &lt;A href="https://1drv.ms/u/c/974774fd4d924f05/EYToe7IfOLlBp0votY1HcegBI1YHw7PgkWNG9aSrUHUHYw?e=psEgFj" target="_blank" rel="noopener"&gt;SlicerMockup.pbix&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;The “Slicer – Existing” tab shows the current issue, while the “Slicer – Expectation” shows the expected result, assuming a “This Month” + “Yesterday” combination. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your suggestions.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2025 20:08:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Power-BI-Slicers-Default-Year-Month-Day-First-Day-of-the-Month/m-p/4633902#M177398</guid>
      <dc:creator>danvrabie</dc:creator>
      <dc:date>2025-04-01T20:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Slicers - Default Year / Month / Day – First Day of the Month Issue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Power-BI-Slicers-Default-Year-Month-Day-First-Day-of-the-Month/m-p/4634378#M177411</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="876325" data-lia-user-login="danvrabie" class="lia-mention lia-mention-user"&gt;danvrabie&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for reaching out to Microsoft Fabric Community.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The problem with the initial CurrentMonth Measure was that it directly compared the difference between each date in the Calendar table and the current date using DATEDIFF. When today is the 1st of the month, this comparison would return 0, indicating that it's still within the same month. But for your business logic, you actually wanted the previous month (March) to be labeled as "This Month" when it's the 1st of April, rather than showing April itself.&lt;BR /&gt;To address this, we revised the DAX by adding a check for the first day of the month. If it's the 1st of the month, the formula displays the previous month (March) as "This Month." Otherwise, it follows the original logic of showing the current month.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here’s the revised DAX formula for the CurrentMonth column:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CurrentMonth =&amp;nbsp;&lt;BR /&gt;VAR __current_date = UTCNOW() - (3 / 24)&lt;BR /&gt;VAR __is_first_of_month = DAY(__current_date) = 1&lt;BR /&gt;VAR __dif_month = DATEDIFF('Calendar'[Date], __current_date, MONTH)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;RETURN&lt;BR /&gt;IF(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; __is_first_of_month,&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(__dif_month = -1, "This Month", FORMAT('Calendar'[Date], "MMMM")),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(__dif_month = 0, "This Month", FORMAT('Calendar'[Date], "MMMM"))&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post&amp;nbsp;helps, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;STRONG&gt;Accepting as solution&amp;nbsp;&lt;/STRONG&gt;to help the other members find it more quickly,&amp;nbsp;don't forget to give a&amp;nbsp;&lt;STRONG&gt;"Kudos"&lt;/STRONG&gt;&amp;nbsp;– I’d truly appreciate it!&amp;nbsp;&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;Anjan Kumar Chippa&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Apr 2025 06:42:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Power-BI-Slicers-Default-Year-Month-Day-First-Day-of-the-Month/m-p/4634378#M177411</guid>
      <dc:creator>v-achippa</dc:creator>
      <dc:date>2025-04-02T06:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Slicers - Default Year / Month / Day – First Day of the Month Issue</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Power-BI-Slicers-Default-Year-Month-Day-First-Day-of-the-Month/m-p/4635355#M177459</link>
      <description>&lt;P&gt;Hi Anjan,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for the quick reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tested the proposed solution and had to make one change, where the first IF statement compares against a +1 and not -1 (most probably a typo).&lt;/P&gt;&lt;P&gt;I have also added an additional IF statement to not show future months in my slicer.&lt;/P&gt;&lt;P&gt;Below the amended solution, which meets all my requirements.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once again, thank you for providing this solution, Anjan!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dan&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CurrentMonth =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;__current_date&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;UTCNOW&lt;/SPAN&gt;&lt;SPAN&gt;() - (&lt;/SPAN&gt;&lt;SPAN&gt;3&lt;/SPAN&gt;&lt;SPAN&gt; / &lt;/SPAN&gt;&lt;SPAN&gt;24&lt;/SPAN&gt;&lt;SPAN&gt;)&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lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"MMMM"&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Apr 2025 15:19:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Power-BI-Slicers-Default-Year-Month-Day-First-Day-of-the-Month/m-p/4635355#M177459</guid>
      <dc:creator>danvrabie</dc:creator>
      <dc:date>2025-04-02T15:19:34Z</dc:date>
    </item>
  </channel>
</rss>

