<?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: DAX expression to filter column for dates only in last month? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-expression-to-filter-column-for-dates-only-in-last-month/m-p/2610043#M75666</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have no data to work with but this shall not be very complex&lt;/P&gt;&lt;P&gt;first you need to retrieve the dates in the past month:&lt;/P&gt;&lt;P&gt;VAR CurrentMonth = MAX ( 'Date'[Month] ) --Preferred "year month key" to avoid the previous year problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;VAR PreviousMonthDates =&lt;BR /&gt;CALCULATE LTABLE (&lt;/P&gt;&lt;P&gt;VALUES ( TableName[Date] ),&lt;/P&gt;&lt;P&gt;'Date'[Month] =&amp;nbsp;&lt;SPAN&gt;CurrentMonth - 1,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;REMOVEFILTERS ( )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;then you need to extract the day number of each of the available dates.&amp;nbsp;&lt;BR /&gt;VAR T1 =&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ADDCOLUMNS (&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;PreviousMonthDates,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"@DayNum", DAY ( [Date] )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;then select the day number column&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;VAR PreviousDays =&lt;BR /&gt;SELECTCOLUMNS ( T1, "Day Number", [@DayNum] )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;then you can calculate for example you sales amount&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;CALCULATE (&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;SUM ( TableName[Sales] ),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;FILTER ( 'Date', DAY ( 'Date'[Date] ) IN&amp;nbsp;PreviousDays ),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Other filters and/or calculate modifiers as required&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Jun 2022 16:32:21 GMT</pubDate>
    <dc:creator>tamerj1</dc:creator>
    <dc:date>2022-06-29T16:32:21Z</dc:date>
    <item>
      <title>DAX expression to filter column for dates only in last month?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-expression-to-filter-column-for-dates-only-in-last-month/m-p/2609868#M75661</link>
      <description>&lt;P&gt;Hey everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to generate a measure that filters a column with dates for those which are only from the last month or last 30 days.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to use this in a calcuate function to see if the amount of rows which have the date in the last month and which meet antoher critera are greater than 0.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2022 15:17:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-expression-to-filter-column-for-dates-only-in-last-month/m-p/2609868#M75661</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-29T15:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: DAX expression to filter column for dates only in last month?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-expression-to-filter-column-for-dates-only-in-last-month/m-p/2610043#M75666</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have no data to work with but this shall not be very complex&lt;/P&gt;&lt;P&gt;first you need to retrieve the dates in the past month:&lt;/P&gt;&lt;P&gt;VAR CurrentMonth = MAX ( 'Date'[Month] ) --Preferred "year month key" to avoid the previous year problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;VAR PreviousMonthDates =&lt;BR /&gt;CALCULATE LTABLE (&lt;/P&gt;&lt;P&gt;VALUES ( TableName[Date] ),&lt;/P&gt;&lt;P&gt;'Date'[Month] =&amp;nbsp;&lt;SPAN&gt;CurrentMonth - 1,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;REMOVEFILTERS ( )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;then you need to extract the day number of each of the available dates.&amp;nbsp;&lt;BR /&gt;VAR T1 =&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ADDCOLUMNS (&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;PreviousMonthDates,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"@DayNum", DAY ( [Date] )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;then select the day number column&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;VAR PreviousDays =&lt;BR /&gt;SELECTCOLUMNS ( T1, "Day Number", [@DayNum] )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;then you can calculate for example you sales amount&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;CALCULATE (&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;SUM ( TableName[Sales] ),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;FILTER ( 'Date', DAY ( 'Date'[Date] ) IN&amp;nbsp;PreviousDays ),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Other filters and/or calculate modifiers as required&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2022 16:32:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-expression-to-filter-column-for-dates-only-in-last-month/m-p/2610043#M75666</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-06-29T16:32:21Z</dc:date>
    </item>
    <item>
      <title>Re: DAX expression to filter column for dates only in last month?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-expression-to-filter-column-for-dates-only-in-last-month/m-p/2610382#M75685</link>
      <description>&lt;P&gt;Hey, thanks for getting back!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I proabably should have offered more context about the column I want to look through. It has dates from when projects are closed, and it may not have a date within it from the last month, so I do not think the MAX function would work here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, it has a bunch of dates of projects which are closed, and then a placeholder value (Sunday, December 31, 1899) for all projects which are still open. Again, the goal would be to see if say, "June" is present in any cell in the column for this month.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2022 19:52:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-expression-to-filter-column-for-dates-only-in-last-month/m-p/2610382#M75685</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-29T19:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: DAX expression to filter column for dates only in last month?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-expression-to-filter-column-for-dates-only-in-last-month/m-p/2610483#M75692</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this a measure. MAX will only retrieve the current month visible in the filter context. Not sure what are slicing by. A screenshot of your visual will be of a great help to understand better.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2022 21:24:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-expression-to-filter-column-for-dates-only-in-last-month/m-p/2610483#M75692</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-06-29T21:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: DAX expression to filter column for dates only in last month?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-expression-to-filter-column-for-dates-only-in-last-month/m-p/2612160#M75795</link>
      <description>&lt;P&gt;The visual is a picture that gets switched by the SWITCH function depending on if the condition is met. It seems like the DAX function has to do all the calcualtions without leveraging a filter?&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2022 13:10:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-expression-to-filter-column-for-dates-only-in-last-month/m-p/2612160#M75795</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-30T13:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: DAX expression to filter column for dates only in last month?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-expression-to-filter-column-for-dates-only-in-last-month/m-p/2612190#M75796</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can you join a zoom meeting to explain further. I sent you meeting request on private message&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2022 13:23:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-expression-to-filter-column-for-dates-only-in-last-month/m-p/2612190#M75796</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-06-30T13:23:05Z</dc:date>
    </item>
    <item>
      <title>Re: DAX expression to filter column for dates only in last month?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-expression-to-filter-column-for-dates-only-in-last-month/m-p/2612234#M75798</link>
      <description>&lt;P&gt;Here is some sample data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have a "report date" column which is the column i want to filter for only those dates in the past month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tuesday, January 18, 2022&lt;/P&gt;&lt;P&gt;Thursday, February 17, 2022&lt;/P&gt;&lt;P&gt;Sunday, December 31, 1899&lt;/P&gt;&lt;P&gt;Sunday, December 31, 1899&lt;/P&gt;&lt;P&gt;Tuesday, June 14, 2022&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;^ Above is the formatt of the dates in this column, the one from 1899 is a placeholder value for unfinished projects.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have another column to filter by, called "status"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Closed&lt;/P&gt;&lt;P&gt;Open&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;^ This column holds these values&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems to me that I need a switch function, which checks if is it is true that, there are &amp;gt; 0 projects within the last month that are closed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the "Image by Cloudscope" as the visualization which holds my images. It holds their values as text which I had formatted as image urls.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jun 2022 13:38:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-expression-to-filter-column-for-dates-only-in-last-month/m-p/2612234#M75798</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-30T13:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: DAX expression to filter column for dates only in last month?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-expression-to-filter-column-for-dates-only-in-last-month/m-p/2619469#M76241</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the DAX to calculate the number of records with a status of closed in the last thirty days:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Count record =

CALCULATE (

    COUNT ( 'Table'[status] ),

    FILTER (

        'Table',

        [status] = "Closed"

            &amp;amp;&amp;amp; [report date] &amp;lt;= TODAY ()

            &amp;amp;&amp;amp; [report date]

                &amp;gt;= ( TODAY () - 30 )

    )

)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you just want to know if the result is greater than 0, you can use this DAX&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;result =

VAR _c =

    CALCULATE (

        COUNT ( 'Table'[status] ),

        FILTER (

            'Table',

            [status] = "Closed"

                &amp;amp;&amp;amp; [report date] &amp;lt;= TODAY ()

                &amp;amp;&amp;amp; [report date]

                    &amp;gt;= ( TODAY () - 30 )

        )

    )

RETURN

IF ( _c &amp;gt; 0, "Yes", "No" )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Final output:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Jianbo Li&lt;/P&gt;&lt;P&gt;If this post &lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2022 09:55:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-expression-to-filter-column-for-dates-only-in-last-month/m-p/2619469#M76241</guid>
      <dc:creator>v-jianboli-msft</dc:creator>
      <dc:date>2022-07-05T09:55:27Z</dc:date>
    </item>
  </channel>
</rss>

