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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
gavinf4444
Frequent Visitor

Determining if event happened in next occurrence

Hello, I have a set of records from various machines which will list any event logs given from an automatic check.  If there are no events to record then this is still saved (shows as blank in the Event column). 

What I want to highlight is if a machine recorded any event (non-blank in Event column) for 2 successive records, eg in my sample data below, I want to show the record for Mac B on 02/01/2023 because it recorded "Non Start" on 01/01/2023 and its subsequent record is "Ignite" on 02/01/2023.

I don't need to highlight Mac C because, although it recorded "Non Start" on 01/01/2023 and "Ignite" on 03/01/2023, it recorded a blank event on 02/01/2023 so effectively its account is reset.

 

Machine IDEventDateHighlight
Mac A 01/01/2023 
Mac BNon Start01/01/2023 
Mac CNon Start01/01/2023 
Mac A 02/01/2023 
Mac BIgnite02/01/2023x
Mac C 02/01/2023 
Mac A 03/01/2023 
Mac B 03/01/2023 
Mac CIgnite03/01/2023 

I've seen a few similar requests here involving a calculated column but nothing exactly the same that I can get to work.

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

Hi @gavinf4444 ,

 

Please try:

Highlight = 
var _a = MAXX(FILTER('Table',[Machine ID]=EARLIER('Table'[Machine ID])&&[Event]<>BLANK()&&[Date]<EARLIER('Table'[Date])),[Date])
return IF([Event]<>BLANK()&&[Date]-1=_a,"X")

Final output:

vjianbolimsft_0-1675919965432.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-jianboli-msft
Community Support
Community Support

Hi @gavinf4444 ,

 

Please try:

Highlight = 
var _a = MAXX(FILTER('Table',[Machine ID]=EARLIER('Table'[Machine ID])&&[Event]<>BLANK()&&[Date]<EARLIER('Table'[Date])),[Date])
return IF([Event]<>BLANK()&&[Date]-1=_a,"X")

Final output:

vjianbolimsft_0-1675919965432.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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