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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Smits474
Frequent Visitor

Column with multiple checks

Hey guys,

 

I want to add a column with a calculation but i don't know the right formula to create it.

 

I want to check if the date in a cell matches the date in the next cell in the same column,

If this if true, i want to check if the matching cells have the same 'name of person' in the next column,

If this is true, i want to check which timestamp is the first one.

 

I then want to add the date value + test 1 as value in the new column

For the next cell, i want to ad the date value + test 2 as value in the column

 

Thanks in advance,

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I was a little too fast in my example, that will sequence all events from same person regardless of the date.

 

To also consider sequence with each individual day you can alter the code to:

Sequence =

var curPerson = [Person]

var curTime=[TimeStamp]

var curDate = [TimeStamp].[Date]
return FORMAT([TimeStamp],"YYYY-MM-DD") & " test-" & (COUNTROWS(FILTER(Events, [Person] = curPerson && Events[TimeStamp].[Date] = curDate && Events[TimeStamp] < curTime))+1)

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi,
When you say you want to check if a date matches the date in the "next cell" I guess you mean some other row in your table, right?

In Power BI there is no such concept of next or previous rows since all there is to the engine is tables that consists of one or more columns. 

 

To achive what you are trying to do you need to create some filter that returns the rows in your table that matches your conditions and from them you can evaluate the sequence of timestamps for those rows.

 

Take a look at the following simple example where I have created a column that will create a sequence for all rows with matching date and person

Sequence.PNG 

Anonymous
Not applicable

I was a little too fast in my example, that will sequence all events from same person regardless of the date.

 

To also consider sequence with each individual day you can alter the code to:

Sequence =

var curPerson = [Person]

var curTime=[TimeStamp]

var curDate = [TimeStamp].[Date]
return FORMAT([TimeStamp],"YYYY-MM-DD") & " test-" & (COUNTROWS(FILTER(Events, [Person] = curPerson && Events[TimeStamp].[Date] = curDate && Events[TimeStamp] < curTime))+1)

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.