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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Sum of max values per product

Hello, guys, hope you're doing well. 

I am having struggle trying to solve a problem, let me explain it. 

So there is 3 columns, Cod Produto (represents product code), Nr Sequencia (Sequence Number) and Qtd Total

thatjoey20_0-1716813736923.png


I have a measure that brings me the value of qtd total of highest sequence number, or, the last sequence

STK =
VAR STOK = MAX('fEstoque Lancamento'[Nr Sequencia])
RETURN CALCULATE(
                 VALUES('fEstoque Lancamento'[Qtd Total]),
                 'fEstoque Lancamento'[Nr Sequencia] = STOK
)
thatjoey20_1-1716814285338.png

 




So, my next challenge is to sum the  Qtd total of all products only for the highest sequence number for each individual product.

thatjoey20_2-1716814352219.png


As you can see above, I have the value of the last sequence for each product, but the problem is that the measure only brings the real last sequence product value, that is 3.743,12. And what I need is to sum the value of the last sequence of all the products. 


1 ACCEPTED SOLUTION
Wilson_
Memorable Member
Memorable Member

Hi thatjoey20,

 

Try this in a new measure:

SUMX (
    VALUES ( 'fEstoque Lancamento'[Cod Produto] ),
    [STK]
)

 

----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)

 

P.S. Need a more in-depth consultation for your Power BI data modeling or DAX issues? Feel free to hire me on Upwork or DM me directly on here! I would love to clear up your Power BI headaches.




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

Proud to be a Super User!





View solution in original post

1 REPLY 1
Wilson_
Memorable Member
Memorable Member

Hi thatjoey20,

 

Try this in a new measure:

SUMX (
    VALUES ( 'fEstoque Lancamento'[Cod Produto] ),
    [STK]
)

 

----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)

 

P.S. Need a more in-depth consultation for your Power BI data modeling or DAX issues? Feel free to hire me on Upwork or DM me directly on here! I would love to clear up your Power BI headaches.




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

Proud to be a Super User!





Helpful resources

Announcements
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.