Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Find Latest Transaction Date for Each article

So I have this Table, now I need a way to choose only the records I have marked green. The record with the latest date that is. 

 

  • Hi Anonymous,

     

    You could create a calculated table like this:

    New table_1 =
    FILTER (
        'Test Data1',
        'Test Data1'[Date]
            = CALCULATE (
                MAX ( 'Test Data1'[Date] ),
                ALLEXCEPT ( 'Test Data1', 'Test Data1'[ArticleNo] )
            )
    )

     

    Best regards,

    Yuliana Gu

3 Replies

  • Hi Anonymous,

     

    The easiest way is to filter out the information on the table by max date aggregating the information, if you want to put the information on a card you need to have a measure that is something like this:

     

    Total = 
    CALCULATE (
        SUMX (
            SUMMARIZE (
                ALL (
                    'Table'[ArticleNo];
                    'Table'[DateOfMovement];
                    'Table'[DateOfMovement];
                    'Table'[Value]
                );
                'Table'[ArticleNo];
                "Date"; MAX ( 'Table'[DateOfMovement] );
                "TotalValue"; SUM ( 'Table'[Value] )
            );
            [TotalValue]
        )
    )

    See the options below:

     

    Regards,

    MFelix

  • v-yulgu-msft's avatar
    v-yulgu-msft
    Microsoft Employee

    Hi Anonymous,

     

    You could create a calculated table like this:

    New table_1 =
    FILTER (
        'Test Data1',
        'Test Data1'[Date]
            = CALCULATE (
                MAX ( 'Test Data1'[Date] ),
                ALLEXCEPT ( 'Test Data1', 'Test Data1'[ArticleNo] )
            )
    )

     

    Best regards,

    Yuliana Gu

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks v-yulgu-msft, it works, The only problem is when I have more than one transaction on the same article the same date. Then this function summerize all values that date, I only want one of the values that date. I want the lowest value that date.