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
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!

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.