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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
mcinnisbr
Advocate I
Advocate I

Filter Last Value based on the max/lastdate and sum the correct total

Hi.
I have a survey input table where, evetually, the same customers will submit the most recent count of a required value. I'm able to filter out previous submissions to display the most recent count based on MAX/ last date.  (Using either below measures).  However, i'd like the total column to also sum up the values for the most recent MAX/;last date.  The totals row is showing the most recent MAX value as the total (9) in my table view, but i'd like to see (31) if possible.  Not sure if i'm doing this the correct way. Help?

 

LastestDate = CALCULATE (
SUM ( 'table'[customer current count]),
FILTER ( ALL ( 'table' ), 'table'[Start time] = MAX('table'[Start time] ) ),
VALUES ('testdata-w-data'[What VAW agency are you reporting for?])
)
 
or 
Lastestdate =
CALCULATE(
SUM('table' [customer current count]),
FILTER ( ALL ( 'table' ), 'table'[Start time] = MAX('table'[Start time] )))

 

mcinnisbr_0-1603752093241.png

 

1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

@mcinnisbr adding a sumx function to iterate the fields in the rows.

 try this code

Lastestdate =
SUMX(VALUES('table'[CustomerName]),
VAR _MaxDate=CALCULATE(MAX('table'[Start time] ))
RETURN
CALCULATE(
SUM('table' [customer current count]),
FILTER ( ALL ( 'table' ), 'table'[Start time] = _MaxDate )))

View solution in original post

2 REPLIES 2
wdx223_Daniel
Super User
Super User

@mcinnisbr adding a sumx function to iterate the fields in the rows.

 try this code

Lastestdate =
SUMX(VALUES('table'[CustomerName]),
VAR _MaxDate=CALCULATE(MAX('table'[Start time] ))
RETURN
CALCULATE(
SUM('table' [customer current count]),
FILTER ( ALL ( 'table' ), 'table'[Start time] = _MaxDate )))

Ask a question to the internet and the internet comes through. Thanks friend, you're brilliant. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.