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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Midguel
Helper I
Helper I

SUM of MAX values in SUMMARIZE function

Hi!

I think i'm missing some DAX function, i have this code for a calculated table:

SUMMARIZE('produccion chat y ret','produccion chat y ret'[C-OP],'produccion chat y ret'[N-COLADA-O],'produccion chat y ret'[W-Q-TONELA-O],"fecha mov",MAX('produccion chat y ret'[Fecha MOVTO]))

and is returning me this table (filtered to be more clear): 

aplic.PNG

and i wanted to SUM the tons for the MAX date of my table so i tried this code:

SUMMARIZE('produccion chat y ret','produccion chat y ret'[C-OP],'produccion chat y ret'[N-COLADA-O],"fecha mov",MAX('produccion chat y ret'[Fecha MOVTO]),"tns",SUM('produccion chat y ret'[W-Q-TONELA-O]))

but it's returning me the total sum:

aplic2.PNG

it should only sum the first two rows with date of 26/08, how can i reach this result?

 

Thank you for your help!

2 REPLIES 2
Greg_Deckler
Super User
Super User

@Midguel - I'm thinking:

Measure = 
  VAR __Table = 
      SUMMARIZE('produccion chat y ret','produccion chat y ret'[C-OP],'produccion chat y ret'[N-COLADA-O],'produccion chat y ret'[W-Q-TONELA-O],"fecha mov",MAX('produccion chat y ret'[Fecha MOVTO]))
  VAR __MaxDate = MAXX(__Table,[fecha mov])
RETURN
  SUMX(FILTER(__Table,[fecha mov]=__MaxDate),[W-Q-TONELA-O])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi, thank you for your answer, i noticed that this is for a new measure but i'm trying to create a new calculated table, is there a way to do use this DAX but in a calculated table format?

Thank you again for your help.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors