Forum Discussion
First transaction for each user for each day
- 3 years ago
Supposing you have a table like:
user_id amount created_at A 1 5/4/2023 10:01 A 2 5/4/2023 10:02 A 3 5/4/2023 10:03 B 11 5/4/2023 10:01 B 22 5/4/2023 10:02 B 33 5/4/2023 10:03 try like:
1)add a calculated column like:date = DATEVALUE([created_at])2)plot a table visual with user_id and date columns with a measure like:
DailyFirstAmt = MINX( TOPN( 1, data, data[created_at], 1 ), data[amount] )it worked like:
Hi FreemanZ ,thank you for your willingness to help.
So, I'm gonna try to explain as simple as possible.
So basically our customer have multiple transactions per day. What I need is the get their first transaction of certain day. I'm gonna post pic with example.
Okay, so i circled couple examples. so you see user 3659 had two transaction, first one is 5.00$ at 19:55, and the other one is for 10.00$ at 19:45. Some users only have one transaction per day which is alright. But for those with multiple transactions i need DAX to return first transaction for that day for each user(in this case it is user-3658,amount 10.00$,time 19:45). So I need earliest transaction for each day, becouse most of the users have transactions every day. I want to see what is their first transaction in a day for every user.
I hope I explained well.
Thank you!
- FreemanZ3 years ago
Super User
Supposing you have a table like:
user_id amount created_at A 1 5/4/2023 10:01 A 2 5/4/2023 10:02 A 3 5/4/2023 10:03 B 11 5/4/2023 10:01 B 22 5/4/2023 10:02 B 33 5/4/2023 10:03 try like:
1)add a calculated column like:date = DATEVALUE([created_at])2)plot a table visual with user_id and date columns with a measure like:
DailyFirstAmt = MINX( TOPN( 1, data, data[created_at], 1 ), data[amount] )it worked like:
- madzgalj_darko3 years agoFrequent Visitor
Perfect FreemanZ,
This is exactly what i was looking for! You really helped!
Thank you, all the best!