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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Calculate Sum Per grouping for Latest date

I have a table that looks loosely like this:

Project NameSprintNameSprintDateValue
ProjectABack-End22-Oct6
ProjectAFront-End21-Oct5
ProjectAFront-End20-Oct2
ProjectABack-End21-Oct1
ProjectBFront-End22-Oct5

 

I want in a metric (to be more specific, it will be defined as a variable amidst a larger equation), a way to sum the Values (column 4) from only the latest (Column 3) of each Sprint Name (Column 2). Within the report that are filtered by Project Names (Column 1).

 

I've tried filters, and group by's but since the latest date isn't always the same between sprints (one sprint's latest update is on October 22nd, the other is on October 21st), I'm having difficulty coming up with the right dax function.

Anyone have any idea?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I'm replying to myself because I think I solved it doing the following:

In my Table I created a column that checks the latest date:

MaxDate = CALCULATE(MAX('ProjectTable[SprintDate]),FILTER('ProjectTable, ProjectTable[SprintName]=EARLIER(ProjectTable[SprintName])))
and then a second column to create a flag
LatestValue = If(ProjectTable[Metric Date] = ProjectTable[MaxDate], 1, 0)
Finally the measure itself has the following formula
    SUMX(
        VALUES(ProjectTable[SprintName]),
        CALCULATE(
            SUM(Project Table[Value]), 
                FILTER(ProjectTable,ProjectTable[Type] = "TypeA"
                && ProjectTable[LatestValue] = "1")
            ))

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Sorry, I forgot to Specify something. 

There's a 5th column in the table that needs to be included in the filters.

So right now I have the following which doesn't work:

SUMX(
        VALUES(ProjectTable[SprintName]),
        CALCULATE(SUM(ProjectTable[Value]), FILTER(ProjectTable[Type] = "typeA" &&
            'ProjectTable[SprintDate] = MAX ( ProjectTable[SprintDate])))) 

 And since this will ultimately be just a variable inside a larger metric calculation, I don't want to summarize a new table for it.

Anonymous
Not applicable

I'm replying to myself because I think I solved it doing the following:

In my Table I created a column that checks the latest date:

MaxDate = CALCULATE(MAX('ProjectTable[SprintDate]),FILTER('ProjectTable, ProjectTable[SprintName]=EARLIER(ProjectTable[SprintName])))
and then a second column to create a flag
LatestValue = If(ProjectTable[Metric Date] = ProjectTable[MaxDate], 1, 0)
Finally the measure itself has the following formula
    SUMX(
        VALUES(ProjectTable[SprintName]),
        CALCULATE(
            SUM(Project Table[Value]), 
                FILTER(ProjectTable,ProjectTable[Type] = "TypeA"
                && ProjectTable[LatestValue] = "1")
            ))

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.