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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. 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
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.