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
M_SBS_6
Helper V
Helper V

Measure based on latest date

Hi, 

I have a date and value column within my table. 

 

I have a card and within that, I need the value based on the latest date. I could have 5 rows of data linked to one date so need to sum them up. 

 

Example below, my card would return a value of 1800.

 

Date. Desc.  Value

10/07/2024  test1.  1000

10/07/2024. Test2.   800

09/07/2024  test1.   600

09/07/2024. Test 2.  300

1 ACCEPTED SOLUTION
manvishah17
Responsive Resident
Responsive Resident

Hi @M_SBS_6 ,
You can use either measure or calculated column ,
Measure :

 

LatestDateValueSum = 
CALCULATE(
    SUM('Table'[Value]),
    FILTER(
        'Table',
        'Table'[Date] =  MAX('Table'[Date])
    )

 

or 
Create a calculated column to rank the dates so you can identify the latest date:


DateRank =
RANKX(
ALL('Table'[Date]),
'Table'[Date],
,
DESC,
DENSE
)

Create a measure to sum the values for the latest date by filtering the data based on the rank:

LatestDateValueSum =
CALCULATE(
SUM('Table'[Value]),
FILTER(
'Table',
'Table'[DateRank] = 1
)
)

 

View solution in original post

3 REPLIES 3
manvishah17
Responsive Resident
Responsive Resident

Hi @M_SBS_6 ,
You can use either measure or calculated column ,
Measure :

 

LatestDateValueSum = 
CALCULATE(
    SUM('Table'[Value]),
    FILTER(
        'Table',
        'Table'[Date] =  MAX('Table'[Date])
    )

 

or 
Create a calculated column to rank the dates so you can identify the latest date:


DateRank =
RANKX(
ALL('Table'[Date]),
'Table'[Date],
,
DESC,
DENSE
)

Create a measure to sum the values for the latest date by filtering the data based on the rank:

LatestDateValueSum =
CALCULATE(
SUM('Table'[Value]),
FILTER(
'Table',
'Table'[DateRank] = 1
)
)

 

AnkitaaMishra
Continued Contributor
Continued Contributor

Hi @M_SBS_6 ,

please try below DAX : 

Total_for_Max_Date =
CALCULATE(
    SUM(Example[Value]),
    FILTER(
        Example,
        Example[Date] = MAX(Example[Date])
    )
)

ankita_mishra_9_0-1720606974346.png


If this works for you, please accept it as solution.

Thanks,

Ankita

rajendraongole1
Super User
Super User

Hi @M_SBS_6 - can you try below measure to get the data as per latest date  

 

Measure used:

Latest Date Value =
VAR LatestDate = MAX('Latest'[Date])
RETURN
CALCULATE(
    SUM('Latest'[Value]),
    'Latest'[Date] = LatestDate
)

 

rajendraongole1_0-1720606396869.png

 

 

It works

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





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

Proud to be a Super User!





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.