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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
viber15
New Member

Create a calculated table with the date of when the status was changed

Hi all,

 

I'm trying to create a calculated table filter the latest status for each item and the date that status was last changed for each item but I'm having trouble to achieve it.

 

Here is an example of the table I have

 

IDStatusDepartmentDate
1OpenFinance2020-01-01
1ClosedFinance2020-02-01
1ClosedHR2020-03-01

 

I tried using this DAX formula:

 

Summary Table = SUMMARIZE (

'Table',

'Table'[ID],

"State", LASTNONBLANK('Table'[State], 1),

"Date", LASTDATE('Table'[Date].[Date])

)

 

But with that I get this result, showing the date as the latest date available for that ID, instead of showing the date for time the state was last changed

IDStateDate
1Closed2020-03-01

 

But what I need is for it to show the date of the latest State change, like this

IDStateDate
1Closed2020-02-01

 

I also tried changing it to FIRSTDATE and then it shows the very first date for that ID (2020-01-01).

 

Thanks in advance!

3 REPLIES 3
ryan_mayu
Super User
Super User

@viber15 

 

Please try this

Table 2 = 
VAR TBL=SUMMARIZE('Table (2)','Table (2)'[ID],'Table (2)'[DEPARTMENT],"COUNT",COUNTROWS('Table (2)'),"DATE",MAX('Table (2)'[DATE]),"STATUS",MAXX(FILTER('Table (2)','Table (2)'[ID]=EARLIER('Table (2)'[ID])&&'Table (2)'[DATE]=MAX('Table (2)'[DATE])),'Table (2)'[STATUS]))
RETURN SUMMARIZE(FILTER(TBL,[COUNT]>1),'Table (2)'[ID],[DATE],[STATUS])

1.PNG





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

Proud to be a Super User!




Hi Ryan,

 

Thanks for the quick answer!

 

Unfortunately, even though it works for this simple table I provided as a sample, it doesn't work for my own table, which actually is more complex than that one.

 

My table has 16 columns and the date in it changes when there is a change on any of the columns. When I use the formula provided and I add all the columns it has (other than the status and date) before the "COUNT",COUNTROWS('Table (2)') section, the calculated table returns empty.

@viber15 

Since I am not able to see your full data, maybe you can try create a column first

COUNT = COUNTX(FILTER('Table','Table'[ID]=EARLIER('Table'[ID])&&'Table'[DEPARTMENT]=EARLIER('Table'[DEPARTMENT])),'Table'[ID])

Then create table again.

Table 2 = SELECTCOLUMNS(FILTER('Table','Table'[STATUS]="CLOSED"&&'Table'[COUNT]>1),"ID",'Table'[ID],"status",'Table'[STATUS],"department",'Table'[DEPARTMENT],"date",'Table'[DATE])

 

 





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

Proud to be a Super User!




Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors