powerbidaxdata-analysispowerbi-desktop

How to group/summarize and sum the amount of the lates date in DAX


I have a sample data as below. I would like to GroupBY Group1 and Group2 variables, SUM the amount and only keep the Max(Date) using DAX. Many thanks in advance.

Group1 Group2  Date    Amount
A1      B1     6\20\2025  3
A1      B1     6\20\2025  5
A1      B1     6\19\2025  7
A2      B2     6\20\2025  9
A2      B2     6\19\2025  11

Expected Answer
A1      B1     6\20\2025  8 
A2      B2     6\20\2025  9

Solution

  • enter image description here

    Table 2 = 
    ADDCOLUMNS(
        SUMMARIZE('Table', 'Table'[Group1],'Table'[Group2]),
        "Date", CALCULATE(MAX('Table'[Date])),
        "Amount", 
        VAR x = CALCULATE(MAX('Table'[Date]))
        RETURN
        CALCULATE(SUM('Table'[Amount]), 'Table'[Date] = x)
    )