<?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: Retrieve last day's data in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Retrieve-last-day-s-data/m-p/2563086#M72970</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;Thank you for your feedback, I have tried to set this up but I can't get the figures when there are no figures the day before.&lt;BR /&gt;For example, I have here the case with shipped files&lt;BR /&gt;I can see in the data that there were some from 03/06/2022 but not before. When I use the measurements, it shows me (Empty).&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;However, it works very well for the days that follow. Do you have a tip to solve this?&lt;BR /&gt;Thanks a lot !&lt;/P&gt;</description>
    <pubDate>Tue, 07 Jun 2022 07:34:08 GMT</pubDate>
    <dc:creator>David-INTEX</dc:creator>
    <dc:date>2022-06-07T07:34:08Z</dc:date>
    <item>
      <title>Retrieve last day's data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Retrieve-last-day-s-data/m-p/2555710#M72539</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello to all,&lt;/P&gt;&lt;P&gt;In a report I would like to display the figures for Friday on Monday (knowing that we have no figures in the weekend).&lt;BR /&gt;Let's imagine we are on 23/05/2022, I want to display on the screen the number of files of 20/05/2022.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I already have a DAX formula:&lt;BR /&gt;Turnover of the previous day =&lt;BR /&gt;VAR cd = MAX ( 'Date'[Date] )&lt;BR /&gt;VAR previousdate =&lt;BR /&gt;CALCULATE (&lt;BR /&gt;MAX ( 'Date'[Date] ),&lt;BR /&gt;FILTER ( ALLSELECTED ( 'Date' ), 'Date'[Date] &amp;lt; cd )&lt;BR /&gt;)&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE (&lt;BR /&gt;SUM ( 'Order'[Amount] ),&lt;BR /&gt;FILTER ( ALLSELECTED ( 'Date' ), 'Date'[Date] = previousdate )&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately I can't do what I want at the moment.&lt;/P&gt;&lt;P&gt;Thank you for your help.&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;</description>
      <pubDate>Thu, 02 Jun 2022 14:31:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Retrieve-last-day-s-data/m-p/2555710#M72539</guid>
      <dc:creator>David-INTEX</dc:creator>
      <dc:date>2022-06-02T14:31:18Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve last day's data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Retrieve-last-day-s-data/m-p/2556186#M72566</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;You can try these measures. Please first add Date Table(named Dates) and mark as Date Table and form relationship to your data table on DateCreation). I will paste Date Table code below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;MODELING&amp;gt;NEW TABLE&amp;gt; see below&lt;/P&gt;&lt;P&gt;Add two new measures after Date Table is connected properly.&lt;/P&gt;&lt;P&gt;Total Amt = SUM(Table[Nombre..Dossier])&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Previous Date Amt = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;FirstvisDate&lt;/SPAN&gt;&lt;SPAN&gt; =&l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lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It will be great if you add a Date Table and form relationship with your data table. MODELING&amp;gt;NEW TABLE&lt;/P&gt;&lt;P&gt;then this DAX code:&lt;/P&gt;&lt;P&gt;Dates = ADDCOLUMNS ( CALENDAR (FIRSTDATE(Sheet1[&amp;nbsp;Date]), TODAY()), "year", YEAR ( [Date] ), "MonthNumber", FORMAT ( [Date], "MM" ), "year-month", FORMAT ( [Date], "YYYY-MM" ), "month-year", FORMAT ( [Date], "MM-'YY" ) )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this works for you.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jun 2022 18:44:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Retrieve-last-day-s-data/m-p/2556186#M72566</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-06-02T18:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve last day's data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Retrieve-last-day-s-data/m-p/2557447#M72651</link>
      <description>&lt;P&gt;Thanks for your reply.&lt;BR /&gt;I'll try it and I give you update&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 09:21:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Retrieve-last-day-s-data/m-p/2557447#M72651</guid>
      <dc:creator>David-INTEX</dc:creator>
      <dc:date>2022-06-03T09:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve last day's data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Retrieve-last-day-s-data/m-p/2560332#M72811</link>
      <description>&lt;P&gt;I have tried the solution but I can't get what I want. Is there any other solution?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 06:53:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Retrieve-last-day-s-data/m-p/2560332#M72811</guid>
      <dc:creator>David-INTEX</dc:creator>
      <dc:date>2022-06-06T06:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve last day's data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Retrieve-last-day-s-data/m-p/2561057#M72859</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;You can add calc columns. You can sub in your table name and date into the below. This should work for you. Good luck!&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Index&lt;/SPAN&gt; =&lt;SPAN&gt; RANKX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;MyTable&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt; MyTable&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;Date&lt;/SPAN&gt;&lt;SPAN&gt;],&lt;/SPAN&gt; ,&lt;SPAN&gt; ASC&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt; Dense&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Prev Value = CALCULATE (&amp;nbsp;&amp;nbsp;&amp;nbsp; SUM ( MyTable[Value] ),&amp;nbsp;&amp;nbsp;&amp;nbsp; FILTER (&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ALLEXCEPT ( MyTable, MyTable[Attribute] ),&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;MyTable[Index]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;= MAX ( MyTable[Index] ) - 1&amp;nbsp;&amp;nbsp; &amp;nbsp;))&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 11:52:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Retrieve-last-day-s-data/m-p/2561057#M72859</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-06-06T11:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve last day's data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Retrieve-last-day-s-data/m-p/2562417#M72933</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="396853" data-lia-user-login="David-INTEX" class="lia-mention lia-mention-user"&gt;David-INTEX&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try the following methods.&lt;/P&gt;
&lt;P&gt;Measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;PreTurnover = 
Var PrevDate=MAXX(FILTER(ALL('Date'[Date]),'Date'[Date]&amp;lt;SELECTEDVALUE('Date'[Date])),'Date'[Date])
Var PreTurnover=CALCULATE(SUM('Date'[Value]),FILTER(ALL('Date'),[Date]=PrevDate))
Return
PreTurnover&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Today = CALCULATE([PreTurnover],FILTER(ALL('Date'),[Date]=TODAY()))&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Is this the output you expect?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _Charlotte&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 02:06:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Retrieve-last-day-s-data/m-p/2562417#M72933</guid>
      <dc:creator>v-zhangti</dc:creator>
      <dc:date>2022-06-07T02:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve last day's data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Retrieve-last-day-s-data/m-p/2563086#M72970</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;Thank you for your feedback, I have tried to set this up but I can't get the figures when there are no figures the day before.&lt;BR /&gt;For example, I have here the case with shipped files&lt;BR /&gt;I can see in the data that there were some from 03/06/2022 but not before. When I use the measurements, it shows me (Empty).&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;However, it works very well for the days that follow. Do you have a tip to solve this?&lt;BR /&gt;Thanks a lot !&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 07:34:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Retrieve-last-day-s-data/m-p/2563086#M72970</guid>
      <dc:creator>David-INTEX</dc:creator>
      <dc:date>2022-06-07T07:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve last day's data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Retrieve-last-day-s-data/m-p/2563255#M72975</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="396853" data-lia-user-login="David-INTEX" class="lia-mention lia-mention-user"&gt;David-INTEX&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you provide a simple example file? Sensitive data can be removed in advance.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;&lt;SPAN&gt;How to provide sample data in the Power BI Forum - Microsoft Power BI Community&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What kind of expected results do you expect? You can also show it with pictures.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 08:24:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Retrieve-last-day-s-data/m-p/2563255#M72975</guid>
      <dc:creator>v-zhangti</dc:creator>
      <dc:date>2022-06-07T08:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve last day's data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Retrieve-last-day-s-data/m-p/2579792#M73988</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Sorry for the delay in responding.&lt;/P&gt;&lt;P&gt;The expected result is that on Monday morning, I have the Friday figures displayed every time. Currently, since in my Dates table, I have the weekend days, my result is impossible with the proposed solutions.&lt;BR /&gt;Do you have a solution to remove the weekend days in the Dates table in DAX?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2022 09:38:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Retrieve-last-day-s-data/m-p/2579792#M73988</guid>
      <dc:creator>David-INTEX</dc:creator>
      <dc:date>2022-06-15T09:38:05Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve last day's data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Retrieve-last-day-s-data/m-p/2580611#M74022</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;You can add 2 calc columns to your date table. Assume Date Table is named "Dates".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WeekDay = WEEKDAY(Dates[Date])&amp;nbsp; &amp;nbsp;// this will give you day of week 1-7&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;WorkDay = &lt;/SPAN&gt;&lt;SPAN&gt;Dates[WeekDay]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;lt;&amp;gt; &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp;&amp;amp; &lt;/SPAN&gt;&lt;SPAN&gt;Dates[WeekDay]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;lt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;7 // this will give TRUE for M-F and False for Weekends.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;You can filter so you set this to TRUE and weekends won't be involved.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;You can make just one calc col in Dates if you want to do:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;WorkDay Flag =&amp;nbsp;&lt;BR /&gt;var dayofweek =&amp;nbsp; WEEKDAY(Dates[Date])&lt;BR /&gt;result&lt;BR /&gt;dayofweek &amp;lt;&amp;gt; 1 &amp;amp;&amp;amp; dayofweek&amp;nbsp;&amp;lt;&amp;gt;7&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I hope this helps&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 15 Jun 2022 14:37:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Retrieve-last-day-s-data/m-p/2580611#M74022</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-06-15T14:37:28Z</dc:date>
    </item>
  </channel>
</rss>

