<?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: Adjust matrix dates (in intervals) based on slicer selection in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adjust-matrix-dates-in-intervals-based-on-slicer-selection/m-p/1413642#M26231</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, its possible, see below:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;___check = 
var _mindate = CALCULATE( MIN(tblSales[sales_date_time]), ALLSELECTED(tblSales))
var _maxdate = CALCULATE(MAX(tblSales[sales_date_time]), ALLSELECTED(tblSales))
var _daysbetween =  SUMX(VALUES(tblSales[sales_ref]), CALCULATE(DATEDIFF( MAX(tblSales[sales_date_time]) , MIN(tblSales[sales_date_time]),DAY)))
var _number = ROUNDDOWN(DATEDIFF(_mindate, _maxdate,DAY) / 7,0)
var _tbl = GENERATESERIES(0,_number,1)
var _tbl2 = SELECTCOLUMNS(ADDCOLUMNS(_tbl, "sales_date_time", _maxdate - ([Value] * 7)), "sales_date_time", [sales_date_time])
return
CALCULATE(SUM(tblSales[sales_amount]),INTERSECT(SELECTCOLUMNS(tblSales,"sales_date_time",[sales_date_time]),_tbl2))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Link to &lt;A href="https://1drv.ms/u/s!AvU6hhKLfmEcgsZ8023SGnaiF9c4tA?e=dwa29o" target="_self"&gt;file&lt;/A&gt;.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Please mark as solution if so. Thumbs up for the effort are appreciated.&lt;BR /&gt;&lt;BR /&gt;Kind regards,&amp;nbsp;&lt;BR /&gt;Steve.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Oct 2020 17:05:30 GMT</pubDate>
    <dc:creator>stevedep</dc:creator>
    <dc:date>2020-10-05T17:05:30Z</dc:date>
    <item>
      <title>Adjust matrix dates (in intervals) based on slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adjust-matrix-dates-in-intervals-based-on-slicer-selection/m-p/1407954#M26045</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a Power BI report where I am using the Matrix Visual and have a date slicer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the matrix, I have the Date value in the Column field. I need the dates to adjust with the dates selected in the slicer and also show in intervals of 7 days. I have tried binning the Date field into 7 days, but the last day shown in the Matrix is related to the latest Sunday, vs the last date selected in the slicer. I have also tried several dax formulas, but I can only get the last date shown in the matrix to correspond with the Maximum date in my data set.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas on a formula that will allow me to show the Date field in the matrix in increments of 7 days&amp;nbsp;&lt;U&gt;and&lt;/U&gt; also display the last date that corresponds with the latest date selected in the slicer? (In my example below, the last date in the matrix should be 8/31 instead of 9/2). Here is the formula I am using to achieve this:&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;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2020 17:47:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adjust-matrix-dates-in-intervals-based-on-slicer-selection/m-p/1407954#M26045</guid>
      <dc:creator>hawkeyes12</dc:creator>
      <dc:date>2020-10-01T17:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: Adjust matrix dates (in intervals) based on slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adjust-matrix-dates-in-intervals-based-on-slicer-selection/m-p/1408582#M26067</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="135887" data-lia-user-login="hawkeyes12" class="lia-mention lia-mention-user"&gt;hawkeyes12&lt;/a&gt; , as the header is coming from a column which can be a bin(week end date). A column can not respond to slicer selection. So I doubt that can be done easily.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Oct 2020 04:02:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adjust-matrix-dates-in-intervals-based-on-slicer-selection/m-p/1408582#M26067</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-10-02T04:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: Adjust matrix dates (in intervals) based on slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adjust-matrix-dates-in-intervals-based-on-slicer-selection/m-p/1413422#M26222</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt; thank you for the reply - this information is very helpful! I wasn't sure if there was a way to overcome this with a dax formula, so thank you for letting me know.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2020 15:46:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adjust-matrix-dates-in-intervals-based-on-slicer-selection/m-p/1413422#M26222</guid>
      <dc:creator>hawkeyes12</dc:creator>
      <dc:date>2020-10-05T15:46:41Z</dc:date>
    </item>
    <item>
      <title>Re: Adjust matrix dates (in intervals) based on slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adjust-matrix-dates-in-intervals-based-on-slicer-selection/m-p/1413642#M26231</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, its possible, see below:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;___check = 
var _mindate = CALCULATE( MIN(tblSales[sales_date_time]), ALLSELECTED(tblSales))
var _maxdate = CALCULATE(MAX(tblSales[sales_date_time]), ALLSELECTED(tblSales))
var _daysbetween =  SUMX(VALUES(tblSales[sales_ref]), CALCULATE(DATEDIFF( MAX(tblSales[sales_date_time]) , MIN(tblSales[sales_date_time]),DAY)))
var _number = ROUNDDOWN(DATEDIFF(_mindate, _maxdate,DAY) / 7,0)
var _tbl = GENERATESERIES(0,_number,1)
var _tbl2 = SELECTCOLUMNS(ADDCOLUMNS(_tbl, "sales_date_time", _maxdate - ([Value] * 7)), "sales_date_time", [sales_date_time])
return
CALCULATE(SUM(tblSales[sales_amount]),INTERSECT(SELECTCOLUMNS(tblSales,"sales_date_time",[sales_date_time]),_tbl2))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Link to &lt;A href="https://1drv.ms/u/s!AvU6hhKLfmEcgsZ8023SGnaiF9c4tA?e=dwa29o" target="_self"&gt;file&lt;/A&gt;.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Please mark as solution if so. Thumbs up for the effort are appreciated.&lt;BR /&gt;&lt;BR /&gt;Kind regards,&amp;nbsp;&lt;BR /&gt;Steve.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2020 17:05:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adjust-matrix-dates-in-intervals-based-on-slicer-selection/m-p/1413642#M26231</guid>
      <dc:creator>stevedep</dc:creator>
      <dc:date>2020-10-05T17:05:30Z</dc:date>
    </item>
    <item>
      <title>Re: Adjust matrix dates (in intervals) based on slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adjust-matrix-dates-in-intervals-based-on-slicer-selection/m-p/1416698#M26330</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="4037" data-lia-user-login="stevedep" class="lia-mention lia-mention-user"&gt;stevedep&lt;/a&gt;&amp;nbsp;thank you so much for the help and detailed reply!! I am trying to apply it to my PBI report but getting stuck on one part: What is the purpose of the Values(tblSales[sales_ref]) part of the bar_daysbetween&amp;nbsp;formula? I can't figure out how to apply it to my scenario.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var _daysbetween =&amp;nbsp; SUMX(VALUES(tblSales[sales_ref]), CALCULATE(DATEDIFF( MAX(tblSales[sales_date_time]) , MIN(tblSales[sales_date_time]),DAY)))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;</description>
      <pubDate>Wed, 07 Oct 2020 01:29:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adjust-matrix-dates-in-intervals-based-on-slicer-selection/m-p/1416698#M26330</guid>
      <dc:creator>hawkeyes12</dc:creator>
      <dc:date>2020-10-07T01:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: Adjust matrix dates (in intervals) based on slicer selection</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adjust-matrix-dates-in-intervals-based-on-slicer-selection/m-p/1416955#M26331</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="135887" data-lia-user-login="hawkeyes12" class="lia-mention lia-mention-user"&gt;hawkeyes12&lt;/a&gt;&amp;nbsp;sales ref does not have any purpose, it's some dummy data attribute I added to make it look more realistic. Kind regards Steve&lt;/P&gt;</description>
      <pubDate>Wed, 07 Oct 2020 04:51:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adjust-matrix-dates-in-intervals-based-on-slicer-selection/m-p/1416955#M26331</guid>
      <dc:creator>stevedep</dc:creator>
      <dc:date>2020-10-07T04:51:01Z</dc:date>
    </item>
  </channel>
</rss>

