<?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: Filtering on a date range based on slicer value in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-on-a-date-range-based-on-slicer-value/m-p/4011249#M157984</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="430689" data-lia-user-login="vicky_" class="lia-mention lia-mention-user"&gt;vicky_&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want the user to select the date the week starts from the slicer, I want my measure to calculate totals for the whole week.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently it is only calculating the total for the specific date selected at the slicer and not for the date range in the measure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help greatly apreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 26 Jun 2024 12:30:15 GMT</pubDate>
    <dc:creator>RichFlorida</dc:creator>
    <dc:date>2024-06-26T12:30:15Z</dc:date>
    <item>
      <title>Filtering on a date range based on slicer value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-on-a-date-range-based-on-slicer-value/m-p/4009848#M157982</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;In my report, i'm using a Matrix Visual to display the total of weekly events.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a slicer for users to select the startDate of the week. I use a measure to calculate the endDate of the week, and number of events (see code below).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Num of Events = 

var startDate = SELECTEDVALUE(SearchTable[COMPLAINT_DATE])
var endDate   = startDate + 6

return

CALCULATE( COUNTA( SearchTable[EVENT_NUMBER]) ,
	(SearchTable[COMPLAINT_DATE] &amp;gt;= startDate &amp;amp;&amp;amp; SearchTable[COMPLAINT_DATE] &amp;lt;= endDate)
         )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having an issue with the totals displayed as they are only for the startDate day that is selected at the slicer (only for one day) and not the whole week.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could someone please advise what I need to do to have the measure display the total for a whole week not just the one day.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2024 21:25:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-on-a-date-range-based-on-slicer-value/m-p/4009848#M157982</guid>
      <dc:creator>RichFlorida</dc:creator>
      <dc:date>2024-06-25T21:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering on a date range based on slicer value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-on-a-date-range-based-on-slicer-value/m-p/4009938#M157983</link>
      <description>&lt;P&gt;I would update my calendar table to have more than 1 day included in the "week of" part:&lt;/P&gt;
&lt;P&gt;The below would give me my base calendar table:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Calendar Table = ADDCOLUMNS(CALENDAR(DATE(2020, 1, 1), DATE(YEAR(TODAY()), 12, 31)),     
    "WeekNum",  INT(
        SWITCH(TRUE(),
            MONTH([Date]) = 1 &amp;amp;&amp;amp; WEEKNUM ([Date] + 1, 21) &amp;gt; 50, YEAR([Date]) - 1, 
            MONTH([Date]) = 12 &amp;amp;&amp;amp; WEEKNUM ([Date] + 1, 21) = 1, YEAR([Date]) + 1,
            YEAR([Date])
        ) &amp;amp; FORMAT(WEEKNUM ([Date]  + 1, 21), "00"))
)&lt;/LI-CODE&gt;
&lt;P&gt;The weeknum is taken from another community thread:&amp;nbsp;&lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-get-the-ISO-year-in-DAX-while-ISO-week-looks-so-easy-this/td-p/1870758," target="_blank"&gt;https://community.fabric.microsoft.com/t5/Desktop/How-to-get-the-ISO-year-in-DAX-while-ISO-week-looks-so-easy-this/td-p/1870758,&lt;/A&gt;&amp;nbsp;and it's there to make sure that i have 7 days per week (even if it crosses over a year).&lt;/P&gt;
&lt;P&gt;On the above table, I create a calculated column:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Week Of = FORMAT(CALCULATE(MIN('Date'[Date]), ALLEXCEPT('Date', 'Date'[WeekNum])), "dd/mm/yy")&lt;/LI-CODE&gt;
&lt;P&gt;And then to update your measure, you can remove the calculations for the week range:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Num of Events = COUNTA( SearchTable[EVENT_NUMBER])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2024 22:44:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-on-a-date-range-based-on-slicer-value/m-p/4009938#M157983</guid>
      <dc:creator>vicky_</dc:creator>
      <dc:date>2024-06-25T22:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering on a date range based on slicer value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-on-a-date-range-based-on-slicer-value/m-p/4011249#M157984</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="430689" data-lia-user-login="vicky_" class="lia-mention lia-mention-user"&gt;vicky_&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want the user to select the date the week starts from the slicer, I want my measure to calculate totals for the whole week.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently it is only calculating the total for the specific date selected at the slicer and not for the date range in the measure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help greatly apreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2024 12:30:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-on-a-date-range-based-on-slicer-value/m-p/4011249#M157984</guid>
      <dc:creator>RichFlorida</dc:creator>
      <dc:date>2024-06-26T12:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering on a date range based on slicer value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-on-a-date-range-based-on-slicer-value/m-p/4012070#M157985</link>
      <description>&lt;P&gt;Could someone please provide some insight...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I trying to find out why my filter is not working for the date range specified in the measure "Num of Events", and instead results are only displayed for the startDate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2024 22:37:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-on-a-date-range-based-on-slicer-value/m-p/4012070#M157985</guid>
      <dc:creator>RichFlorida</dc:creator>
      <dc:date>2024-06-26T22:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering on a date range based on slicer value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-on-a-date-range-based-on-slicer-value/m-p/4012444#M158009</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="300297" data-lia-user-login="RichFlorida" class="lia-mention lia-mention-user"&gt;RichFlorida&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Get a Date table with minimum Date and Start of Week columns. Create the relationship between 'Date'[DATE] and 'SearchTable'[COMPLAINT_DATE] and place 'Date'[Start of Week] in the slicer. Then a simple count aggregation will do.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2024 03:24:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-on-a-date-range-based-on-slicer-value/m-p/4012444#M158009</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2024-06-27T03:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: Filtering on a date range based on slicer value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-on-a-date-range-based-on-slicer-value/m-p/4013472#M158074</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I already have a date table, the date on the slicer are the "start of week" dates.&lt;/P&gt;&lt;P&gt;I capture the selected "Start of week" date and use the measure below to get the count for a whole week.&lt;/P&gt;&lt;P&gt;However it is not working as the slicer value overrides my measure and force it to display total for the selected date/day only.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pls advise!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Num of Events = 

var startDate = SELECTEDVALUE(SearchTable[COMPLAINT_DATE])
var endDate   = startDate + 6

return

CALCULATE( COUNTA( SearchTable[EVENT_NUMBER]) ,
	(SearchTable[COMPLAINT_DATE] &amp;gt;= startDate &amp;amp;&amp;amp; SearchTable[COMPLAINT_DATE] &amp;lt;= endDate)
         )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2024 12:49:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Filtering-on-a-date-range-based-on-slicer-value/m-p/4013472#M158074</guid>
      <dc:creator>RichFlorida</dc:creator>
      <dc:date>2024-06-27T12:49:08Z</dc:date>
    </item>
  </channel>
</rss>

