<?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: I need to create a date to use as VAR in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-to-create-a-date-to-use-as-VAR/m-p/1328744#M23490</link>
    <description>&lt;P&gt;&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; , Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attaching the pbix, so you can see the behavior of the data.&lt;BR /&gt;The biggest problem is that when we select a date that is not the end of the month it works well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;But if we select the last day of the month this is the result, as you can see the measure does not work&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A title="Sales_bookings pbix" href="https://drive.google.com/file/d/1FhVeUV89AqOY-Z2EekVraUwyAU9KhkoW/view?usp=sharing" target="_self"&gt;https://drive.google.com/file/d/1FhVeUV89AqOY-Z2EekVraUwyAU9KhkoW/view?usp=sharing&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Aug 2020 11:19:17 GMT</pubDate>
    <dc:creator>arossello</dc:creator>
    <dc:date>2020-08-27T11:19:17Z</dc:date>
    <item>
      <title>I need to create a date to use as VAR</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-to-create-a-date-to-use-as-VAR/m-p/1325239#M23359</link>
      <description>&lt;P&gt;Hello community,&lt;/P&gt;&lt;P&gt;I need to create a measure that has a fixed variable, to perform the future calculation,&lt;/P&gt;&lt;P&gt;Here is the process I am following:&lt;/P&gt;&lt;P&gt;The filters I have are the following:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I need to calculate two measures the sales you make to date and on the other hand the reserved sales that I have in the future, depending on the date selected in Date&lt;/P&gt;&lt;P&gt;This is the result I want to get:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The measures used are the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sales actual = SUM(f_sales[base])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Future Sales = 
VAR FECHAINFORME = DATE(2020,08,22)
RETURN
CALCULATE(
SUM(f_reserva[adr_dia])
,f_reserva[estado_reserva_id]= 1
,f_reserva[externa]= 0
, FILTER(
   f_reserva
   ,f_reserva[fecha]&amp;gt;= FECHAINFORME
))&lt;/LI-CODE&gt;&lt;P&gt;As you can see I am using the DATE () function, but what I want is for this date to be the maximum selected in the Date filter.&lt;/P&gt;&lt;P&gt;I have tried replacing DATE with the following measure:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;day_report_total = CALCULATE(
    MAX('Calendario'[Date])
    ,ALLSELECTED('Calendario')
)&lt;/LI-CODE&gt;&lt;P&gt;But the result is the following:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2020 09:26:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-to-create-a-date-to-use-as-VAR/m-p/1325239#M23359</guid>
      <dc:creator>arossello</dc:creator>
      <dc:date>2020-08-26T09:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: I need to create a date to use as VAR</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-to-create-a-date-to-use-as-VAR/m-p/1325304#M23361</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="58050" data-lia-user-login="arossello" class="lia-mention lia-mention-user"&gt;arossello&lt;/a&gt; , this should have worked. Try like this once &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Future Sales = &lt;BR /&gt;VAR _FECHAINFORME = maxx(ALLSELECTED('Calendario'),'Calendario'[Date])&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM(f_reserva[adr_dia])&lt;BR /&gt;,f_reserva[estado_reserva_id]= 1&lt;BR /&gt;,f_reserva[externa]= 0&lt;BR /&gt;, FILTER(&lt;BR /&gt;f_reserva&lt;BR /&gt;,f_reserva[fecha]&amp;gt;= _FECHAINFORME&lt;BR /&gt;))&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2020 09:53:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-to-create-a-date-to-use-as-VAR/m-p/1325304#M23361</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-08-26T09:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: I need to create a date to use as VAR</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-to-create-a-date-to-use-as-VAR/m-p/1325447#M23365</link>
      <description>&lt;P&gt;Thank you very much for your answer,&lt;/P&gt;&lt;P&gt;I have had a problem if I apply your measure, the result is the following:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The amount is that of 08/22/2020, as you can see future months do not appear.&lt;/P&gt;&lt;P&gt;I don't know what I can do anymore&lt;span class="lia-unicode-emoji" title=":sad_but_relieved_face:"&gt;😥&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2020 10:56:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-to-create-a-date-to-use-as-VAR/m-p/1325447#M23365</guid>
      <dc:creator>arossello</dc:creator>
      <dc:date>2020-08-26T10:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: I need to create a date to use as VAR</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-to-create-a-date-to-use-as-VAR/m-p/1326233#M23390</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="58050" data-lia-user-login="arossello" class="lia-mention lia-mention-user"&gt;arossello&lt;/a&gt; , try like&lt;/P&gt;
&lt;P&gt;Future Sales =&lt;BR /&gt;VAR _FECHAINFORME = maxx(ALLSELECTED('Calendario'),'Calendario'[Date])&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM(f_reserva[adr_dia])&lt;BR /&gt;,f_reserva[estado_reserva_id]= 1&lt;BR /&gt;,f_reserva[externa]= 0&lt;BR /&gt;, FILTER(&lt;BR /&gt;all(f_reserva)&lt;BR /&gt;,f_reserva[fecha]&amp;gt;= _FECHAINFORME&lt;BR /&gt;))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you share sample data and sample output in table format? &lt;/P&gt;</description>
      <pubDate>Wed, 26 Aug 2020 14:48:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-to-create-a-date-to-use-as-VAR/m-p/1326233#M23390</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-08-26T14:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: I need to create a date to use as VAR</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-to-create-a-date-to-use-as-VAR/m-p/1328744#M23490</link>
      <description>&lt;P&gt;&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; , Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attaching the pbix, so you can see the behavior of the data.&lt;BR /&gt;The biggest problem is that when we select a date that is not the end of the month it works well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;But if we select the last day of the month this is the result, as you can see the measure does not work&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A title="Sales_bookings pbix" href="https://drive.google.com/file/d/1FhVeUV89AqOY-Z2EekVraUwyAU9KhkoW/view?usp=sharing" target="_self"&gt;https://drive.google.com/file/d/1FhVeUV89AqOY-Z2EekVraUwyAU9KhkoW/view?usp=sharing&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2020 11:19:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-to-create-a-date-to-use-as-VAR/m-p/1328744#M23490</guid>
      <dc:creator>arossello</dc:creator>
      <dc:date>2020-08-27T11:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: I need to create a date to use as VAR</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-to-create-a-date-to-use-as-VAR/m-p/1328834#M23496</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="58050" data-lia-user-login="arossello" class="lia-mention lia-mention-user"&gt;arossello&lt;/a&gt;&amp;nbsp;Attaching the file below my signature. I have added a disconnected slicer to filter the dates, Let me know if that is what you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;Future Sales =
VAR DisMaxDate =
    CALCULATE (
        MAX ( 'Disconnected Calendario'[Date] ),
        ALLSELECTED ( 'Disconnected Calendario'[Date] )
    )
VAR VisualMaxDate =
    MAX ( Calendario[Date] )
VAR Result =
    SUMX (
        ADDCOLUMNS (
            FILTER ( VALUES ( Calendario[Date] ), Calendario[Date] &amp;gt; DisMaxDate ),
            "@Sales", [Total Sales]
        ),
        [@Sales]
    )
RETURN
    Result
&lt;/LI-CODE&gt;&lt;LI-CODE lang="php"&gt;Current Sales = 
VAR DisMaxDate =
    CALCULATE (
        MAX ( 'Disconnected Calendario'[Date] ),
        ALLSELECTED ( 'Disconnected Calendario'[Date] )
    )
VAR Result =
    SUMX (
        ADDCOLUMNS (
            FILTER ( VALUES ( Calendario[Date] ), Calendario[Date] &amp;lt;= DisMaxDate ),
            "@Sales", [Total Sales]
        ),
        [@Sales]
    )
RETURN
    Result
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2020 12:00:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-to-create-a-date-to-use-as-VAR/m-p/1328834#M23496</guid>
      <dc:creator>AntrikshSharma</dc:creator>
      <dc:date>2020-08-27T12:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: I need to create a date to use as VAR</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-to-create-a-date-to-use-as-VAR/m-p/1329174#M23510</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="236628" data-lia-user-login="AntrikshSharma" class="lia-mention lia-mention-user"&gt;AntrikshSharma&lt;/a&gt;&amp;nbsp;&amp;nbsp;Thank you very much, for the solution provided it is great&lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2020 13:59:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/I-need-to-create-a-date-to-use-as-VAR/m-p/1329174#M23510</guid>
      <dc:creator>arossello</dc:creator>
      <dc:date>2020-08-27T13:59:06Z</dc:date>
    </item>
  </channel>
</rss>

