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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
aleksa0131
Frequent Visitor

Latest table entry

Hi,

I want to take only the latest entry for one worker in this table (the active one - where activeTo is max)

 

Sample:

workerIDareaIDactiveFromactiveTo 
mit12108/6/20189/12/2018 
mit12209/12/201812/31/2018 

 

I wrote sql statement ,but i can't convert it into dax :

select * from [workerInArea] where
[workerID] ='mit' and [activeTo] =(
select MAX(activeTo) from [workerInArea]
where [workerID] ='mit')

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @aleksa0131,

 

I made one sample for your reference.

 

1. Enter the sample data as you shared and create a measure as below.

 

Measure = IF(MAX(Table1[activeTo])=CALCULATE(MAX(Table1[activeTo]),ALLEXCEPT(Table1,Table1[workerID])),1,0)

2. Create a table visual and make it filterd by the measure. Then we can get the result as we need.

 

Capture.PNG

 

For more details, please check the pbix as attached.

 

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

3 REPLIES 3
v-frfei-msft
Community Support
Community Support

Hi @aleksa0131,

 

I made one sample for your reference.

 

1. Enter the sample data as you shared and create a measure as below.

 

Measure = IF(MAX(Table1[activeTo])=CALCULATE(MAX(Table1[activeTo]),ALLEXCEPT(Table1,Table1[workerID])),1,0)

2. Create a table visual and make it filterd by the measure. Then we can get the result as we need.

 

Capture.PNG

 

For more details, please check the pbix as attached.

 

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hi @aleksa0131,

 

Does that make sense? If so, kindly mark my answer as a solution to close the case.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
DaFloDo
Resolver I
Resolver I

hi,

 

i do not know if this is the way to go, but it is working for me ...

 

- created a measure "LastChange" that finds the latest activeTo per workerId

LastChange = 
var currentWorkerId = SELECTEDVALUE(AllEntries[workerID])
var lastActiveTo = calculate(
max(AllEntries[activeTo])
;Filter(All(AllEntries);AllEntries[workerID] = currentWorkerId)
)
return lastActiveTo

- created a table that only contains the latest entries per worker

LatestEntries = FILTER(ALL(AllEntries); and( AllEntries[workerID] = AllEntries[workerID]; AllEntries[activeTo] = AllEntries[LastChange]) )

latest entries.png

Best Regards,

Florian

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.