Forum Discussion
Column with multiple checks
- Anonymous9 years ago
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)
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
- Anonymous9 years agoNot 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)