DAX to get latest date of an account name entry











up vote
1
down vote

favorite












I have found similar reported questions, but none of the solutions have worked so far. If I am entering the information incorrectly, please let me know.



I have a table in Power Pivot that contains repeated names, and dates entered that go with the names. What I am trying to do is get the latest date entered for a name.



Example:



Name | Date       | Latest Date
A | 6/24/2016 |
A | 6/24/2017 |
A | 6/24/2018 |
B | 7/05/2010 |
B | 7/05/2011 |
C | 6/8/2009 |
C | 6/8/2010 |
C | 6/8/2011 |


What I would like under Latest Date is to have the latest date that corresponds to the Name. It should look like the following:



Name | Date       | Latest Date
A | 6/24/2016 | 6/24/2018
A | 6/24/2017 | 6/24/2018
A | 6/24/2018 | 6/24/2018
B | 7/05/2010 | 7/5/2011
B | 7/05/2011 | 7/5/2011
C | 6/8/2009 | 6/8/2011
C | 6/8/2010 | 6/8/2011
C | 6/8/2011 | 6/8/2011


I've tried to use the following function, but all I keep getting are #Errors (of course changing the table reference based on the data in the file)



= CALCULATE(
MAX(Table1[Date]);
FILTER(Table1;
Table1[ID] = EARLIER(Table1[ID])
)
)


If the above function is correct, I wonder what I am doing wrong. Which one of the values in the () are column references and which ones are cell references? Perhaps that's where I am going wrong.



Any assistance is very appreciative. I tried to enter the information as nicely as possible so it can be assisted.










share|improve this question




























    up vote
    1
    down vote

    favorite












    I have found similar reported questions, but none of the solutions have worked so far. If I am entering the information incorrectly, please let me know.



    I have a table in Power Pivot that contains repeated names, and dates entered that go with the names. What I am trying to do is get the latest date entered for a name.



    Example:



    Name | Date       | Latest Date
    A | 6/24/2016 |
    A | 6/24/2017 |
    A | 6/24/2018 |
    B | 7/05/2010 |
    B | 7/05/2011 |
    C | 6/8/2009 |
    C | 6/8/2010 |
    C | 6/8/2011 |


    What I would like under Latest Date is to have the latest date that corresponds to the Name. It should look like the following:



    Name | Date       | Latest Date
    A | 6/24/2016 | 6/24/2018
    A | 6/24/2017 | 6/24/2018
    A | 6/24/2018 | 6/24/2018
    B | 7/05/2010 | 7/5/2011
    B | 7/05/2011 | 7/5/2011
    C | 6/8/2009 | 6/8/2011
    C | 6/8/2010 | 6/8/2011
    C | 6/8/2011 | 6/8/2011


    I've tried to use the following function, but all I keep getting are #Errors (of course changing the table reference based on the data in the file)



    = CALCULATE(
    MAX(Table1[Date]);
    FILTER(Table1;
    Table1[ID] = EARLIER(Table1[ID])
    )
    )


    If the above function is correct, I wonder what I am doing wrong. Which one of the values in the () are column references and which ones are cell references? Perhaps that's where I am going wrong.



    Any assistance is very appreciative. I tried to enter the information as nicely as possible so it can be assisted.










    share|improve this question


























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I have found similar reported questions, but none of the solutions have worked so far. If I am entering the information incorrectly, please let me know.



      I have a table in Power Pivot that contains repeated names, and dates entered that go with the names. What I am trying to do is get the latest date entered for a name.



      Example:



      Name | Date       | Latest Date
      A | 6/24/2016 |
      A | 6/24/2017 |
      A | 6/24/2018 |
      B | 7/05/2010 |
      B | 7/05/2011 |
      C | 6/8/2009 |
      C | 6/8/2010 |
      C | 6/8/2011 |


      What I would like under Latest Date is to have the latest date that corresponds to the Name. It should look like the following:



      Name | Date       | Latest Date
      A | 6/24/2016 | 6/24/2018
      A | 6/24/2017 | 6/24/2018
      A | 6/24/2018 | 6/24/2018
      B | 7/05/2010 | 7/5/2011
      B | 7/05/2011 | 7/5/2011
      C | 6/8/2009 | 6/8/2011
      C | 6/8/2010 | 6/8/2011
      C | 6/8/2011 | 6/8/2011


      I've tried to use the following function, but all I keep getting are #Errors (of course changing the table reference based on the data in the file)



      = CALCULATE(
      MAX(Table1[Date]);
      FILTER(Table1;
      Table1[ID] = EARLIER(Table1[ID])
      )
      )


      If the above function is correct, I wonder what I am doing wrong. Which one of the values in the () are column references and which ones are cell references? Perhaps that's where I am going wrong.



      Any assistance is very appreciative. I tried to enter the information as nicely as possible so it can be assisted.










      share|improve this question















      I have found similar reported questions, but none of the solutions have worked so far. If I am entering the information incorrectly, please let me know.



      I have a table in Power Pivot that contains repeated names, and dates entered that go with the names. What I am trying to do is get the latest date entered for a name.



      Example:



      Name | Date       | Latest Date
      A | 6/24/2016 |
      A | 6/24/2017 |
      A | 6/24/2018 |
      B | 7/05/2010 |
      B | 7/05/2011 |
      C | 6/8/2009 |
      C | 6/8/2010 |
      C | 6/8/2011 |


      What I would like under Latest Date is to have the latest date that corresponds to the Name. It should look like the following:



      Name | Date       | Latest Date
      A | 6/24/2016 | 6/24/2018
      A | 6/24/2017 | 6/24/2018
      A | 6/24/2018 | 6/24/2018
      B | 7/05/2010 | 7/5/2011
      B | 7/05/2011 | 7/5/2011
      C | 6/8/2009 | 6/8/2011
      C | 6/8/2010 | 6/8/2011
      C | 6/8/2011 | 6/8/2011


      I've tried to use the following function, but all I keep getting are #Errors (of course changing the table reference based on the data in the file)



      = CALCULATE(
      MAX(Table1[Date]);
      FILTER(Table1;
      Table1[ID] = EARLIER(Table1[ID])
      )
      )


      If the above function is correct, I wonder what I am doing wrong. Which one of the values in the () are column references and which ones are cell references? Perhaps that's where I am going wrong.



      Any assistance is very appreciative. I tried to enter the information as nicely as possible so it can be assisted.







      dax powerpivot






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 13 at 17:39









      Alexis Olson

      11.6k21633




      11.6k21633










      asked Nov 13 at 16:51









      KLomb

      112




      112
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          There are no cell or row references in DAX. Everything is done with filters.



          Try this for Latest Date.



          = CALCULATE(
          MAX(Table1[Date]);
          FILTER(ALL(Table1);
          Table1[Name] = EARLIER(Table1[Name])
          )
          )


          Give this a shot as well if that doesn't do the trick:



          = CALCULATE(
          MAX(Table1[Date]);
          ALLEXCEPT(Table1; Table1[Name])
          )





          share|improve this answer





















          • Thank you very much. That worked.
            – KLomb
            Nov 13 at 20:43










          • Please mark an answer as accepted if it solved your problem. stackoverflow.com/help/someone-answers
            – Alexis Olson
            Nov 13 at 21:04











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53285889%2fdax-to-get-latest-date-of-an-account-name-entry%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          There are no cell or row references in DAX. Everything is done with filters.



          Try this for Latest Date.



          = CALCULATE(
          MAX(Table1[Date]);
          FILTER(ALL(Table1);
          Table1[Name] = EARLIER(Table1[Name])
          )
          )


          Give this a shot as well if that doesn't do the trick:



          = CALCULATE(
          MAX(Table1[Date]);
          ALLEXCEPT(Table1; Table1[Name])
          )





          share|improve this answer





















          • Thank you very much. That worked.
            – KLomb
            Nov 13 at 20:43










          • Please mark an answer as accepted if it solved your problem. stackoverflow.com/help/someone-answers
            – Alexis Olson
            Nov 13 at 21:04















          up vote
          0
          down vote













          There are no cell or row references in DAX. Everything is done with filters.



          Try this for Latest Date.



          = CALCULATE(
          MAX(Table1[Date]);
          FILTER(ALL(Table1);
          Table1[Name] = EARLIER(Table1[Name])
          )
          )


          Give this a shot as well if that doesn't do the trick:



          = CALCULATE(
          MAX(Table1[Date]);
          ALLEXCEPT(Table1; Table1[Name])
          )





          share|improve this answer





















          • Thank you very much. That worked.
            – KLomb
            Nov 13 at 20:43










          • Please mark an answer as accepted if it solved your problem. stackoverflow.com/help/someone-answers
            – Alexis Olson
            Nov 13 at 21:04













          up vote
          0
          down vote










          up vote
          0
          down vote









          There are no cell or row references in DAX. Everything is done with filters.



          Try this for Latest Date.



          = CALCULATE(
          MAX(Table1[Date]);
          FILTER(ALL(Table1);
          Table1[Name] = EARLIER(Table1[Name])
          )
          )


          Give this a shot as well if that doesn't do the trick:



          = CALCULATE(
          MAX(Table1[Date]);
          ALLEXCEPT(Table1; Table1[Name])
          )





          share|improve this answer












          There are no cell or row references in DAX. Everything is done with filters.



          Try this for Latest Date.



          = CALCULATE(
          MAX(Table1[Date]);
          FILTER(ALL(Table1);
          Table1[Name] = EARLIER(Table1[Name])
          )
          )


          Give this a shot as well if that doesn't do the trick:



          = CALCULATE(
          MAX(Table1[Date]);
          ALLEXCEPT(Table1; Table1[Name])
          )






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 13 at 17:44









          Alexis Olson

          11.6k21633




          11.6k21633












          • Thank you very much. That worked.
            – KLomb
            Nov 13 at 20:43










          • Please mark an answer as accepted if it solved your problem. stackoverflow.com/help/someone-answers
            – Alexis Olson
            Nov 13 at 21:04


















          • Thank you very much. That worked.
            – KLomb
            Nov 13 at 20:43










          • Please mark an answer as accepted if it solved your problem. stackoverflow.com/help/someone-answers
            – Alexis Olson
            Nov 13 at 21:04
















          Thank you very much. That worked.
          – KLomb
          Nov 13 at 20:43




          Thank you very much. That worked.
          – KLomb
          Nov 13 at 20:43












          Please mark an answer as accepted if it solved your problem. stackoverflow.com/help/someone-answers
          – Alexis Olson
          Nov 13 at 21:04




          Please mark an answer as accepted if it solved your problem. stackoverflow.com/help/someone-answers
          – Alexis Olson
          Nov 13 at 21:04


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53285889%2fdax-to-get-latest-date-of-an-account-name-entry%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to send String Array data to Server using php in android

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

          Is anime1.com a legal site for watching anime?