Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

I need a help on a simple DAX measure

Hello everybody,

I'm looking for a DAX measure that calculates this :

 

Person    Amount      Week
1011            10$            1
1011            15$            2

1011            18$            3

1011            11$            4
1012             9$             1  
1012             7$             2
1013             3$             1
1013             4$             2
1013             8$             3

 

I need the SUM of Amounts of the last week of each person :

11$ +  7$  + 8$ = 26$

 

Any helps ?

Thank you

2 ACCEPTED SOLUTIONS
petrovnikitamai
Resolver V
Resolver V

i'm not sure but try to add 

1. new column 

max_Week_by_Person = maxx(filter([TableName];earlier([Person])=[Person]);[Week])

2. new mesuare

sum_Amount_byLastWeek = sumx(filter(TableName;[Week]=[max_Week_by_Person]);[Amount])

mb someone knows best way to get it

View solution in original post

LivioLanzo
Solution Sage
Solution Sage

Measure = 
SUMX(
    NATURALINNERJOIN(
        Data,
        ADDCOLUMNS(
            VALUES( Data[Person] ),
            "MaxWeek", CALCULATE( MAX( Data[Week] ) )
        )
    ),
    [Amount] * INT( [MaxWeek] = [Week] )
)

 an alternative approach

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

View solution in original post

4 REPLIES 4
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous,

 

By my tests, the formula from petrovnikitamai and LivioLanzo should solve your problem. 

 

If you have solved your problem, please accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

 

If you still need help, please feel free to ask.

 

Best  Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
LivioLanzo
Solution Sage
Solution Sage

Measure = 
SUMX(
    NATURALINNERJOIN(
        Data,
        ADDCOLUMNS(
            VALUES( Data[Person] ),
            "MaxWeek", CALCULATE( MAX( Data[Week] ) )
        )
    ),
    [Amount] * INT( [MaxWeek] = [Week] )
)

 an alternative approach

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

petrovnikitamai
Resolver V
Resolver V

i'm not sure but try to add 

1. new column 

max_Week_by_Person = maxx(filter([TableName];earlier([Person])=[Person]);[Week])

2. new mesuare

sum_Amount_byLastWeek = sumx(filter(TableName;[Week]=[max_Week_by_Person]);[Amount])

mb someone knows best way to get it

Anonymous
Not applicable

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.