![External User - Mike Dramin (Customer)](https://community.tableau.com/img/userprofile/default_profile_45_v2.png)
Mike Dramin (Member) asked a question.
Dear all,
I would like to calculate the following:
I would like to make a stacked bar chart on Monthly level so to show the percentage of User Activity per month.
How activity should be calculated :
If a User made a Deposit for first Time, so they are First Depositors, they are New Active Users.
If they did a deposit in the previous month as well and in the current month they are Active.
If they did not make a deposit the previous month but they did again in the current month, they are Re-activated.
So for example today we have 2th of December. A User who made a deposit Today first time is New User.
A User who made a deposit yesterday (1th of December) and 10 deposits in November is Active Users. Last but not least, a user who made a Deposit today, but did not make one in November or in October but his first Deposit was in September , he is considered Re-activated.
I have a field called First Depositor which is a number and it is continuous, I have Date and User ID. The thing is that I do not have First Deposit Date but Date in general. so when I want to see when a User made the First Deposit I have to drag First Deposit and Date and check. For example , Date in rows, First Depositor, User ID and I see the following :
Date User ID First Depositor
April 2024 4896307XW 1 (did a First Deposit)
October 2024 3698714HJ 0 (did NOT make a First Deposit)
I was trying to make some LODs based on User ID Frist Deposit and use some IF conditions but it is not working.
Is there anyone who could help or have any hint how I could handle it?
Testing aside (so I might not have got it right working blind), because I don't have your data, I'd categorise each player into their relevant deposit pattern. The date testing is perfunctory, and you'd need to adjust it if it doesn't do exactly what you want. Stacked bars are broken down by categorical fields, like [Colour], or [Country]. While they can be created with dates (used as discrete entities), that doesn't often make much sense in a visual.
IF DATEDIFF('month',{ FIXED [Player ID]: MIN([Date]) }, DATETRUNC('month',TODAY())) = 0 THEN // If deposit this month
IF {FIXED [Player ID]: COUNTD(DATETRUNC('month',[Date])) > 1} THEN // If player has multiple deposits
IF {FIXED [Player ID]: COUNTD(IF DATEDIFF('month',DATETRUNC('month',[Date]), DATETRUNC('month',TODAY())) IN (0,1)) = 1} THEN
// Number of deposits in last 2 months is 1 (and already established there was 1 this month)
"Re-Activated"
ELSE
// Otherwise, 2 deposits in last 2 months, so they are
"Active"
END
// Only option left is that they only have 1 deposit and it was this month
ELSE "New Player"
END