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
darkobrown
Regular Visitor

Get only last change per day where multiple changes per day

I have a change history table. The table looks as this: 

darkobrown_0-1684920801940.png

As you can see the last 2 rows are in the same day. This messes my calculations up when i want to sum it up per day. So i need only 1 entry per day (the latest). 

 

How can i achieve with dax that I only get 1 entry per day where mutliple entries per day exist ? (only when its the same field) 

 

1 ACCEPTED SOLUTION
darkobrown
Regular Visitor

That was not the expected Result. 

But I managed to solve the problem with a collegue. 

Here is the Solution for anyone intrested: 

1. I created a new Column where I formated the 'created' column into "DateAsInteger" :

createdDateAsInt = FORMAT(change_history_SP[created],"YYYYMMDD")

 2. I created another column as following: 

Only1ValueperDay Remaining Sp = 
VAR latestdate= CALCULATE(MAXX(change_history_SP, change_history_SP[created]), ALLEXCEPT(change_history_SP,change_history_SP[createdDateAsInt], change_history_SP[id]))
return 
IF(change_history_SP[created] = latestdate && change_history_SP[field]= "Remaining SP", change_history_SP[newstring] )

By this solution I get only the latest change if there are more than 1 change for the field "Remaining SP". 

And then did the same for the Field "Story Points". 

Now it looks like this: 

darkobrown_0-1684931360168.png

 

View solution in original post

2 REPLIES 2
darkobrown
Regular Visitor

That was not the expected Result. 

But I managed to solve the problem with a collegue. 

Here is the Solution for anyone intrested: 

1. I created a new Column where I formated the 'created' column into "DateAsInteger" :

createdDateAsInt = FORMAT(change_history_SP[created],"YYYYMMDD")

 2. I created another column as following: 

Only1ValueperDay Remaining Sp = 
VAR latestdate= CALCULATE(MAXX(change_history_SP, change_history_SP[created]), ALLEXCEPT(change_history_SP,change_history_SP[createdDateAsInt], change_history_SP[id]))
return 
IF(change_history_SP[created] = latestdate && change_history_SP[field]= "Remaining SP", change_history_SP[newstring] )

By this solution I get only the latest change if there are more than 1 change for the field "Remaining SP". 

And then did the same for the Field "Story Points". 

Now it looks like this: 

darkobrown_0-1684931360168.png

 

vk_pbi
Resolver II
Resolver II

Hi, 

I am not sure about your calculation (sum, average etc), but you can use the MAXX to iterate each row in the table and take the MAX date&time.

Hope this will help you. 

Or else please share some more details to write DAX for you

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.