Forum Discussion
Index column based on date, multiple entries excluded based on time
- 8 years ago
Step 1:
Index =
VAR UserFirstDate = MINX(FILTER('Events Completion';'Events Completion'[user_id] = EARLIER('Events Completion'[user_id]));'Events Completion'[DateTime])
RETURNDIVIDE (DATEDIFF(UserFirstDate ;'Events Completion'[DateTime];DAY);1)+1
Step 2:
Rank =
VAR d = 'Events Completion'[Index]
VAR c = 'Events Completion'[user_id]
RETURN
CALCULATE (
RANK.EQ ( d; 'Events Completion'[Index]; ASC );
FILTER ( ALL ( 'Events Completion'); 'Events Completion'[user_id] = c ))
Hi Phil_Seamark,
The time of day is not important.
Monday would have value 1. The following Wednesday at 10am would have value 2, just like the event at 8pm (value = 2).
ok, then does this get closer?
Column =
VAR UserFirstDate = MINX(FILTER('Table1','Table1'[user_id] = EARLIER('Table1'[user_id])),'Table1'[date] )
RETURN DATEDIFF(UserFirstDate ,'Table1'[date] ,DAY)+1- Atseaukes8 years agoFrequent Visitor
Hi Phil_Seamark,
On the subsequent days the value is correct. However, if there are more days in between, those days are added to the value. The values must be an orderly one.
Like in this example (all have the same user_id):
1-06-18, 12:00 ; value 1
1-06-18, 13:00 ; value 1
2-06-18, 12:00 ; value 2
4-06-18, 12:00 ; value 3 (instead of value 4, which will be the result of the formula I posted)
- Atseaukes8 years agoFrequent Visitor
Hi Phil_Seamark,
Do you have any suggestions what to do else?
Maybe doable with a RANKX?Rank = RANKX('Events Completion';'Events Completion'[Index];;ASC;Dense)
But first it needs to be filtered by 'Events Completion'[User_ID] I guess, right?
- Atseaukes8 years agoFrequent Visitor
Step 1:
Index =
VAR UserFirstDate = MINX(FILTER('Events Completion';'Events Completion'[user_id] = EARLIER('Events Completion'[user_id]));'Events Completion'[DateTime])
RETURNDIVIDE (DATEDIFF(UserFirstDate ;'Events Completion'[DateTime];DAY);1)+1
Step 2:
Rank =
VAR d = 'Events Completion'[Index]
VAR c = 'Events Completion'[user_id]
RETURN
CALCULATE (
RANK.EQ ( d; 'Events Completion'[Index]; ASC );
FILTER ( ALL ( 'Events Completion'); 'Events Completion'[user_id] = c ))