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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
limpfisch
New Member

DAX to return sum of most recent values by ID

Hi there

 

I have a table set up like this

 

limpfisch_0-1699755528904.png

 

 

I wish to create a table visual which takes the sum of the most recent values for each ID for every rounded date time. So the desired output would look like this

 

limpfisch_1-1699755608568.png

 

 

I am using direct query mode.

 

Any help is much appreciated.

 

Thanks

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

I assume the table name is "Data".

Please try the below DAX measure if it suits your requirement.

 

Expected result dax measure: =
SUMX (
    WINDOW (
        -1,
        ABS,
        -1,
        ABS,
        SUMMARIZE ( Data, Data[ID], Data[DateTime], Data[Value] ),
        ORDERBY ( Data[DateTime], ASC ),
        ,
        PARTITIONBY ( Data[ID] )
    ),
    Data[Value]
)

 

Jihwan_Kim_0-1699768066181.png

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Ahmedx
Super User
Super User

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

Screenshot_2.png

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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

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