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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
BramSegers
Frequent Visitor

Recurrent checks possible?

Hi,

 

I'm struggling for a few days with a problem, which I hope can be resolved here Smiley Very Happy

Power BI Desktop.png

I've got a dataset with different traces, including for each trace a Vehicle Codes, Driver code, Date / Time. The most left image is the complete dataset, filtered out with the columns I need & sorted so the traces are sorted descending per vehicle (+ an added index). 

 

The second screenshot are the ones with the traces that interests me: being 1 (logged in), 2 (logged out) & 44. 
What i try to accomplish is an overview for each logged in driver code of the trace 44. So far so good, but now comes the first tricky part: When i come across a trace type 44, I have to check all traces preceding the last 44 trace to find which driver was logged in at the moment the trace 44 appeared (since the last one). The second, and most likely the most trickiest part: there can be more than one logged in driver (see third right upper screenshot), so the trace 44 applies to both.  The right bottom screenshot is the first display of what I want to achieve. 

 

I managed to get via the Group By function in the Query stage to get a list of all logged in drivers for the vehicle, but i didn't managed yet to get it working for the trace-to-trace functionallity and not for the current logged in drivers, just all of them who happened to have logged in at least once.

 

Any help would be very appreciated! 

Thanks in advance

 

EDIT: Dataset

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @BramSegers,

 

Actually, I still not so sure for your summarize logic, can you please explain more about this with some expect result?

 

I create a summarize table with ranking column to summarize your records, below is the sample formulas.

Calculate table:
Table = VAR temp = SUMMARIZE ( ADDCOLUMNS ( FILTER ( data, [type] IN { 1, 2} ), "DateTime", DATEVALUE ( [Datum] ) + TIMEVALUE ( [Tijdstip] ) ), [DateTime], [Voertuig Korte Naam], [Action Code], [type] ) RETURN FILTER ( ADDCOLUMNS ( temp, "Count", COUNTX ( FILTER ( temp, [Action Code] = EARLIER ( [Action Code] ) && [Voertuig Korte Naam] = EARLIER ( [Voertuig Korte Naam] ) ), [type] ) ), [Count] > 1 ) Calculate column: Rank = COUNTROWS( FILTER ( ALLSELECTED ( 'Table' ), [Voertuig Korte Naam] = EARLIER( 'Table'[Voertuig Korte Naam] ) && ISONORAFTER ( [DateTime], EARLIER ( 'Table'[DateTime] ), ASC, [Count], EARLIER ( 'Table'[Count] ), ASC ) ) )
Measure: FirstRank = var list=CALCULATETABLE(VALUES('Table'[Rank]),ALLSELECTED('Table'),VALUES('Table'[Voertuig Korte Naam])) return if( MAX('Table'[Rank]) = MINX(list,[Rank]),"Y","N")

 

Regards,

Xiaoxin Sheng

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @BramSegers,

 

Actually, I still not so sure for your summarize logic, can you please explain more about this with some expect result?

 

I create a summarize table with ranking column to summarize your records, below is the sample formulas.

Calculate table:
Table = VAR temp = SUMMARIZE ( ADDCOLUMNS ( FILTER ( data, [type] IN { 1, 2} ), "DateTime", DATEVALUE ( [Datum] ) + TIMEVALUE ( [Tijdstip] ) ), [DateTime], [Voertuig Korte Naam], [Action Code], [type] ) RETURN FILTER ( ADDCOLUMNS ( temp, "Count", COUNTX ( FILTER ( temp, [Action Code] = EARLIER ( [Action Code] ) && [Voertuig Korte Naam] = EARLIER ( [Voertuig Korte Naam] ) ), [type] ) ), [Count] > 1 ) Calculate column: Rank = COUNTROWS( FILTER ( ALLSELECTED ( 'Table' ), [Voertuig Korte Naam] = EARLIER( 'Table'[Voertuig Korte Naam] ) && ISONORAFTER ( [DateTime], EARLIER ( 'Table'[DateTime] ), ASC, [Count], EARLIER ( 'Table'[Count] ), ASC ) ) )
Measure: FirstRank = var list=CALCULATETABLE(VALUES('Table'[Rank]),ALLSELECTED('Table'),VALUES('Table'[Voertuig Korte Naam])) return if( MAX('Table'[Rank]) = MINX(list,[Rank]),"Y","N")

 

Regards,

Xiaoxin Sheng

Thanks, with this help I found a way out! 

Greg_Deckler
Community Champion
Community Champion

Can you provide sample text data and expected output? Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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