sequence
2 TopicsDAX Calculated Column Sequence of Event Actions and Sessions
I have dataset with users actions logs. We have next data collection logic - every user have it own user_id and we record log of event actions during user session. user_id session_id dateTime event 1 aa 2023-01-01 13:12:11 login 1 aa 2023-01-01 14:12:10 buy 1 bb 2023-01-02 11:12:10 page 2 cc 2023-01-01 10:11:01 login 2 gg 2023-01-03 11:12:11 logout 2 gg 2023-01-03 13:11:03 click 2 gg 2023-01-03 14:10:07 logout The main goal is prepare output and add 2 calculated columns: 1. with events action sequence during every user session and 2. with session sequence during all user lifetime by SQL. Expected output: user_id session_id dateTime event event_seq session_seq 1 aa 2023-01-01 13:12:11 login 1 1 1 aa 2023-01-01 14:12:10 buy 2 1 1 bb 2023-01-02 11:12:10 page 1 2 2 cc 2023-01-01 10:11:01 login 1 1 2 gg 2023-01-03 11:12:11 logout 1 2 2 gg 2023-01-03 13:11:03 click 2 2 2 gg 2023-01-03 14:10:07 logout 3 2 What was done from my side: 1. Successfully create column with events action sequence during session Event Action Sequence = COUNTROWS ( FILTER ( CALCULATETABLE ( Sheet1, ALLEXCEPT (Sheet1, Sheet1[session_id]) ), Sheet1[Date] < EARLIER ( Sheet1[Date] ) || ( Sheet1[Date] = EARLIER ( Sheet1[Date] ) && Sheet1[Time Action] <= EARLIER ( Sheet1[Time Action] ) ) ) ) 2. Sessions Sequence Order By each user - calculated column not prepared - I stucked on it. Only prepared time for each session when it started (minimum time for each session) Min Session DateTime = CALCULATE( MIN(Sheet1[dateTime]), ALLEXCEPT(Sheet1,Sheet1[session_id]) ) So the main help request, how to solve this and create one more column with sessions sequene number orderd ascending by timestamp for each user. Sharing link to my pbix file https://drive.google.com/file/d/1807l9E07oNJv9l5rKWXKxDoc6rniyiYG/view?usp=sharing And sharing link to my sample: https://docs.google.com/spreadsheets/d/1bb7VId8lJ-NQkF43YS739kfc5Ur-1cGy/edit?usp=sharing&ouid=103990807236416334574&rtpof=true&sd=true626Views0likes1CommentHow to Make a Batch ID
Table 1 - 'Source L1 to L3' L1 L2 L3 Batch ID... value1 anothervalue1 andanothervalue1 value2...etc... anothervalue2...etc... andanothervalue2...etc... All values are text Table 2 -'L1Distinct' L1 L1Index value1 1 value2 2...etc... L1 is text, L2 is an index value (Number) Values in L1 are related to L1 in 1st table and are only the DISTINCT values in that tables L1 column Table 3 & 4 'L2Distinct' and L3Distinct' are same as 'L1Distinct' but for L2 and L3 columns All I want to do is take the columns 'L1Index' on table L1Distinct, 'L2Index on table L2Distinct and 'L3Index' on table L3Distinct and present them as a sequence in the original table.... So if the numbers where 1, 3, 10 for example I'd like 1310 in the column. I'm new to DAX and struggling to do this. Any help would be appreciated. (Or even advice on an easier way to make a Batch ID based on all distinct values in each column having the same number ? Thanks!Solved2.2KViews0likes4Comments