Forum Discussion

novicenovice's avatar
novicenovice
Icon for Helper I rankHelper I
7 years ago
Solved

SUM THE LATEST VALUES

Dear all,   I need your help, I would like to make a chart on which for each date I want to get the sum of the lastest values whatever the customer.   I try some formulas (sumx, maxx) but cannot ...
  • Anonymous's avatar
    Anonymous
    7 years ago

    Hi novicenovice,

     

    You can use below measure to achieve your requirement:

    Last Total =
    VAR currDate =
        MAX ( 'DateTable'[Date] )
    VAR summary =
        SUMMARIZE (
            FILTER ( ALLSELECTED ( Table ), [Input Date] <= currDate ),
            [Customer],
            "LastDate", MAX ( Table[INPUT DATE] )
        )
    RETURN
        SUMX (
            CALCULATETABLE (
                Table,
                INTERSECT (
                    SELECTCOLUMNS ( Table, "CUSTOMER", [CUSTOMER], "Date", [INPUT DATE] ),
                    summary
                )
            ),
            [VALUE]
        )
    

     

    Regards,

    Xiaoxin Sheng