Forum Discussion

Ashik008's avatar
Ashik008
Frequent Visitor
2 years ago
Solved

latest date column needed

Hi all,

I need help with data .

I have table with id and date data. I need a column with latest date if the id

service idcompleted date
1016/20/2024
1015/10/2023
10210/10/2023
1031/1/2023
1031/1/2024

 

i need the result 

service idcompleted datelatest complete date
1016/20/20246/20/2024
1015/10/20236/20/2024
10210/10/202310/10/2023
1031/1/20231/1/2024
1031/1/20241/1/2024

Please help me with it

  • Ashik008 

    Latest Completed Date = 
    CALCULATE ( 
        MAX ( 'Table'[completed date] ),
        ALLEXCEPT ( 'Table', 'Table'[service id] )
    )

     

     

4 Replies

  • ajohnso2's avatar
    ajohnso2
    Solution Supplier

    Something like this should work:

    Latest Completion Date =
    VAR _ServiceID = SELECTEDVALUE('YourTable'[Service ID])
    VAR _DateCompleted =
    
    FILTER(
        ADDCOLUMNS(
            CALCULATETABLE(
                ALL('YourTable'[Service ID], 'YourTable'[Date Completed])
            ),
            "@MaxCompletedDate", 'YourTable'[Date Completed]
        ),
        'YourTable'[Service ID] = _ServiceID
    )
    
    RETURN
    MAXX(_DateCompleted, [@MaxCompletedDate])
  • AntrikshSharma's avatar
    AntrikshSharma
    Community Champion

    Ashik008 

    Latest Completed Date = 
    CALCULATE ( 
        MAX ( 'Table'[completed date] ),
        ALLEXCEPT ( 'Table', 'Table'[service id] )
    )

     

     

  • Hi Ashik008 - you can use max function on completed date and filter based on ID with current id.

     

    Calculated columns as below:

    LatestCompleteDate =
    VAR CurrentServiceID = ServiceData[service id]
    RETURN
    CALCULATE(
    MAX(ServiceData[completed date]),
    FILTER(
    ServiceData,
    ServiceData[service id] = CurrentServiceID
    )
    )

     

     

    Report view:

     

     

    Did I answer your question? Mark my post as a solution! This will help others on the forum!
    Appreciate your Kudos!!