0
votes

this is the next part from this question. how to Find out users_id with some conditions filter

i have a table like this

order_id | user_id | createdAt | transaction_amount

order_id as the id of the transaction, user_id as the user, createdAt as the dates, and transaction_amount is the transaction of each id order.

On previous questions, i want to find out users with my conditions based on the parameter (thanks to @Anil for the solution)

this calculated field based on @Anil solution

{Fixed [User Id]: sum(
if [Created At]<=[END_DATE] then 1 else 0 end)}>=2
AND
{FIXED [User Id]: sum(
IF [Created At]<=[END_DATE] AND 
[Created At] >= [START_DATE] THEN 1 ELSE 0 END)}>=1

this is the conditions that i want for user and have the solutions like below :

1. the users are doing transaction before last date in range ('2020-01-31') and atleast doing more than 1 transaction
2. and the users are at least doing 1 transaction in date range ('2020-01-01' until '2020-01-31')

so this is the example of the users who match with this condition

enter image description here

you see the users match with this conditions because the user_id 5615 has 2 transactions in range and out of range date, and it's matched with the condition,

the questions is, the condition are only to find out the user_id who matched with condition, but how to add the filters, so i can filter transaction user in range, so the user_id 5615 was only count the transaction in range (january, 9 2020) and not count the transaction in september 21, 2017

1

1 Answers

1
votes

finally i found the answers based on this website https://kb.tableau.com/articles/howto/creating-a-filter-for-start-and-end-dates-parameters

so i made calculate field with this

[Created At] >= [START_DATE] AND [Created At] <= [END_DATE]

and convert to true so only the selected with matched in range will be appear