Forum Discussion

PaulPalkowski's avatar
PaulPalkowski
Icon for Helper II rankHelper II
6 years ago

Looking for Last Value for each

I have this near complete...

What would I use to get the "last value", or the value with the most recent date/time 

Each site has about 60,000 records

 

Do you need more info to help me on this?

 

 

10 Replies

  • Hi PaulPalkowski ,

     

    On what basis you need the last value?

    Is it just date or along with date any categorical column in your data?

      • Pragati11's avatar
        Pragati11
        Icon for Super User rankSuper User

        Hi PaulPalkowski ,

         

        You can create a column as follows:

         

        Is most recent =
        var thisSite = tablename[Site]
        var thisArea = tablename[Area]
        var mostRecentDate = CALCULATE(MAX(tablename[Date]),FILTER(ALL(tablename), tablename[Site] = thisSite && tablename[Area] = thisArea))
        return
        IF(tablename[Date] = mostRecentDate,"yes","no")

         

        The above DAX will return a column with YES/NO value based on most recent record at Site and Area level. Move this column to your table visual and select "yes". This will just display recent record in the table for a combination of Site and Area.

         

        You can modify the above code as just SITE level or AREA level also.

         

        Replace the right table name and column name in the above dax provided.

         

        Thanks,

        Pragati

  • V-lianl-msft's avatar
    V-lianl-msft
    Icon for Community Support rankCommunity Support

    Hi PaulPalkowski ,

     

    Try to create a measure or column:

    mostRecentDate = CALCULATE(MAX(table[LastDate]),ALLEXCEPT(table,table[Site])) 

     

    Best Regards,
    Liang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • PaulPalkowski's avatar
      PaulPalkowski
      Icon for Helper II rankHelper II

      I have the last date... I need the VALUE from that last date..

      I have Min Value, Max Value, Avg Value for each, just need a new column for the LAST value 

       

      • PaulPalkowski's avatar
        PaulPalkowski
        Icon for Helper II rankHelper II

        here is what my data looks like

        Looking for value of last date for each SITE and AREA