cancel
Showing results for 
Search instead for 
Did you mean: 
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
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors