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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
leandross89
Helper II
Helper II

Display last date that an equipament was repaired in a new register

Hi Dear,

 

I´ve trying to do a code that display the last date that an equipment was repaired,but in a new event (register) that happened an new problem. 
I got to do a measures but I need to do in a column calculated, and my measure code wasn´t work in a power query.

Example my code in a measures was that below:

VAR Date = SELECTEDVALUE('Table1'[Date IN])
VAR previous = CALCULATE(MAX('Table1'[Date OUT]);FILTER(ALL('Table1'[Date IN]);Date >'Table1'[Date IN]))
return
Date
In the example above happened an error of circular when I had created a column calculated, could you help me with?
   column that I want 
serialDate INDate Outlast date out 
A01/01/202005/01/2020noneNone because no exist register before that
B01/01/202006/01/2020none
C01/01/202005/01/2020none
A10/01/202015/01/202005/01/2020 
B12/01/202018/01/202006/01/2020 
C20/01/202024/01/202005/01/2020 
A01/02/202007/03/202015/01/2020 
B02/03/202007/03/202018/01/2020 
C20/03/202025/03/202024/01/2020 
 
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@leandross89 ,

Try

last date out = maxx(filter(table,table[serial]=earlier(table[serial]) && table[Date Out] <earlier(table[Date Out])),table[Date Out])
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@leandross89 ,

Try

last date out = maxx(filter(table,table[serial]=earlier(table[serial]) && table[Date Out] <earlier(table[Date Out])),table[Date Out])
Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

thanks for your help

Greg_Deckler
Community Champion
Community Champion

Maybe : https://community.powerbi.com/t5/Quick-Measures-Gallery/Lookup-Min-Max/td-p/985814

 

Or See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395...



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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