<?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 calculate if datedif between slicer selected date and column date equal to value in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-if-datedif-between-slicer-selected-date-and-column/m-p/1879990#M40378</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , make sure the names are correct. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also try like , You need have some grouping level for this. I assumed - BIItemLedgerRF[Bill ID]&lt;/P&gt;
&lt;P&gt;Measure = &lt;BR /&gt;var _min =MINX(allselected(Parameter),Parameter [Parameter Value])&lt;BR /&gt;return&lt;BR /&gt;CALCULATE(SUM(BIItemLedgerRF[CostAmountActual]),filter(values(BIItemLedgerRF[Bill ID]) , DATEDIFF(_min,max(BIItemLedgerRF[PoDate.PoDate]),DAY)&amp;lt;30))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to get dynamic bucketing. Dynamic Segmentation, Bucketing or Binning: &lt;A href="https://youtu.be/CuczXPj0N-k" target="_blank"&gt;https://youtu.be/CuczXPj0N-k&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;also refer date diff across table&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/Decoding-Direct-Query-in-Power-BI-Part-2-Date-Difference-Across/ba-p/934397#M451" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Decoding-Direct-Query-in-Power-BI-Part-2-Date-Difference-Across/ba-p/934397#M451&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 03 Jun 2021 11:01:15 GMT</pubDate>
    <dc:creator>amitchandak</dc:creator>
    <dc:date>2021-06-03T11:01:15Z</dc:date>
    <item>
      <title>DAX calculate if datedif between slicer selected date and column date equal to value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-if-datedif-between-slicer-selected-date-and-column/m-p/1879406#M40358</link>
      <description>&lt;P&gt;I'm making calculated buckets based on the date difference. Currently, the bucket is generated based on the last date of the current month as below measure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Measure =CALCULATE(SUM(RF[Cost]),DATEDIFF(EOMONTH(TODAY(),0),RF[PoDate],DAY)&amp;lt;30)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Basically this gives sum of the cost if the count of the dates between the current month end date and podate lesser than 30. But i need&amp;nbsp;EOMONTH(TODAY(),0) to be replaced with a user-selected value using a slicer or any other method.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Additionally, I have created&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Parameter = GENERATESERIES(DATE(2021,01,01),DATE(2023,01,01), 1)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Parameter Value = SELECTEDVALUE('Parameter'[Parameter])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;where user to select the date using slicer. But when i replace Parameter value with&amp;nbsp;&lt;SPAN&gt;EOMONTH(TODAY(),0) like below&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Measure = CALCULATE(SUM(BIItemLedgerRF[CostAmountActual]),DATEDIFF(MIN(Parameter[Parameter Value]),BIItemLedgerRF[PoDate.PoDate],DAY)&amp;lt;30)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;But It generates an error by telling&amp;nbsp;Column 'Parameter Value' in table 'Parameter' cannot be found or may not be used in this expression.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Please help me to sort this out struggling with this for a long time.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 03 Jun 2021 06:58:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-if-datedif-between-slicer-selected-date-and-column/m-p/1879406#M40358</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-06-03T06:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: DAX calculate if datedif between slicer selected date and column date equal to value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-if-datedif-between-slicer-selected-date-and-column/m-p/1879990#M40378</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , make sure the names are correct. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also try like , You need have some grouping level for this. I assumed - BIItemLedgerRF[Bill ID]&lt;/P&gt;
&lt;P&gt;Measure = &lt;BR /&gt;var _min =MINX(allselected(Parameter),Parameter [Parameter Value])&lt;BR /&gt;return&lt;BR /&gt;CALCULATE(SUM(BIItemLedgerRF[CostAmountActual]),filter(values(BIItemLedgerRF[Bill ID]) , DATEDIFF(_min,max(BIItemLedgerRF[PoDate.PoDate]),DAY)&amp;lt;30))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to get dynamic bucketing. Dynamic Segmentation, Bucketing or Binning: &lt;A href="https://youtu.be/CuczXPj0N-k" target="_blank"&gt;https://youtu.be/CuczXPj0N-k&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;also refer date diff across table&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/Decoding-Direct-Query-in-Power-BI-Part-2-Date-Difference-Across/ba-p/934397#M451" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Decoding-Direct-Query-in-Power-BI-Part-2-Date-Difference-Across/ba-p/934397#M451&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 11:01:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-if-datedif-between-slicer-selected-date-and-column/m-p/1879990#M40378</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2021-06-03T11:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: DAX calculate if datedif between slicer selected date and column date equal to value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-if-datedif-between-slicer-selected-date-and-column/m-p/1879993#M40379</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It can't be used in this expression because &lt;STRONG&gt;logical expressions under CALCULATE can't contain measures&lt;/STRONG&gt;. They can only be of this form (more or less):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;F(T[Col]) &amp;lt;operator&amp;gt; Value,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where Value is a constant and F is a function that depends only on one column in a base table, never measures.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Therefore, first capture the value of the measure in a variable and then use the variable in a well-formed expression. And you don't need any MIN around the parameter value. You should also follow Best Practices when formatting and writing DAX code. Otherwise, you'll get into trouble rather sooner than later.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sqlbi.com/articles/rules-for-dax-code-formatting/" target="_blank"&gt;Rules for DAX Code Formatting - SQLBI&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 11:03:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-if-datedif-between-slicer-selected-date-and-column/m-p/1879993#M40379</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-06-03T11:03:51Z</dc:date>
    </item>
    <item>
      <title>Re: DAX calculate if datedif between slicer selected date and column date equal to value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-if-datedif-between-slicer-selected-date-and-column/m-p/1880099#M40388</link>
      <description>&lt;P&gt;The method you mentioned has worked. Additionally by following the references you mentioned, found this article&amp;nbsp;&lt;A href="https://www.credera.com/insights/creating-aging-report-using-a-user-selected-date-in-power-bi" target="_blank"&gt;https://www.credera.com/insights/creating-aging-report-using-a-user-selected-date-in-power-bi&lt;/A&gt;&amp;nbsp;on how to handle bucketing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&amp;nbsp;&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 12:08:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-if-datedif-between-slicer-selected-date-and-column/m-p/1880099#M40388</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-06-03T12:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: DAX calculate if datedif between slicer selected date and column date equal to value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-if-datedif-between-slicer-selected-date-and-column/m-p/1880103#M40390</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp; Found the solution from another user.&amp;nbsp; Till today I have not followed formating since I was transferred to DAX from M query very recently. Thank you for aware me of best practising on DAX code and for the reference.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 12:11:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-calculate-if-datedif-between-slicer-selected-date-and-column/m-p/1880103#M40390</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-06-03T12:11:10Z</dc:date>
    </item>
  </channel>
</rss>

