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
Anonymous
Not applicable

Sum last values by max date

Hello, guys!

Need some help to create a measure.

Have a table:

datelink_idareappmpublication_date
17.08.20201246626955100007.08.2020
17.08.20201276455045060011.08.2020
24.08.20201485430213750015.08.2020
24.08.20201276455045064020.08.2020
31.08.20201485430213760015.08.2020
31.08.20201276455045080020.08.2020

 

Need to receive the SUM of the latest values PPM for each LINK_ID betweendates (07.08.2020-30.08.2020) by Date.

 

In this case the right answer is 2 140

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@Anonymous - This is sort of Lookup Min/Max - https://community.powerbi.com/t5/Quick-Measures-Gallery/Lookup-Min-Max/m-p/985814#M434

 

In your case, maybe:

Measure = 
  VAR __Table = 
    ADDCOLUMNS(
      SUMMARIZE('Table',[link_id],"__Date",MAX([date])),
      "__PPM",MAXX(FILTER(ALL('Table'),[link_id]=EARLIER([link_id]) && [date]=[__Date]),[ppm)
    )
RETURN
  SUMX(__Table,[__PPM])

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

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

@Anonymous - This is sort of Lookup Min/Max - https://community.powerbi.com/t5/Quick-Measures-Gallery/Lookup-Min-Max/m-p/985814#M434

 

In your case, maybe:

Measure = 
  VAR __Table = 
    ADDCOLUMNS(
      SUMMARIZE('Table',[link_id],"__Date",MAX([date])),
      "__PPM",MAXX(FILTER(ALL('Table'),[link_id]=EARLIER([link_id]) && [date]=[__Date]),[ppm)
    )
RETURN
  SUMX(__Table,[__PPM])

@ 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...
Anonymous
Not applicable

Thank you @Greg_Deckler  so much!

It works brilliant!

Sweet!

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

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.