2 Replies Latest reply: Aug 29, 2018 3:06 AM by Caga Mel RSS

    Finding most recent date in a table

    Caga Mel

      I have two tables and I want to print the most recent month from SalesTable

       

      If I had another column marking 'Sold' measure (e.g. Measure) I could do this:

      max({<Measure={"Sold"}, YEAR ={$(=max(Year))}>} Month)        -- and this would give me 11

       

      is there a way to pick that most recent month in a table without adding another column?

       

       

      SalesTable:

      Month, Year,  Sold

      11, 2018, 29

      10,2018, 40

      .

      .

       

      PlanTable:

      Month, Year,  Predicted

      12, 2018, 30

      11,2018, 45

      10,2018, 37

      .

      .

        • Re: Finding most recent date in a table
          Shraddha Gajare

          I would say it will be easier if you add 1more column.

           

          SalesTable:

           

          Load *,

          'Sales' as Source_Flag;

          Load * Inline [

          Month, Year,  Sold

          11, 2018, 29

          10,2018, 40

          ];

          .

          .

           

          PlanTable:

          Load *,

          'Plan' as Source_Flag;

          Load * Inline [

          Month, Year,  Predicted

          12, 2018, 30

          11,2018, 45

          10,2018, 37

          ];

           

           

          And in expression you can use

           

          Max({<Source_Flag = {"Sales"}>}Month)