Recording Followers as of last social media post date within a month [Tableau Calculated Field] - date

my problem is as follows.
I have social media data for multiple networks (facebook, twitter, instagram, etc.) and multiple profiles within each network. I have a date parameter which controls the dashboard based on year/month of the data history to summarize data by month.
I need to record the followers of each network and profile, in aggregate and separately, for each month. This calculation is tricky because I need to aggregate the followers by the latest post of each profile within the month. I would like to view those audience numbers for the month using a filter by network and profile.
I have tried a number of things to isolate followers for one profile and one network, hoping I could expand this to a scenario with multiple, and not been successful. This has included the following calculated fields:
(Given a filter for one network and one profile already applied)
attempt 1:
IF LAST() = 0 then SUM([Instagram Profile Followers]) END // This one pulls in total followers for last month (641.6K)
attempt 2:
LOOKUP(SUM( if MONTH([Date]) = MONTH([Date Parameter]) and YEAR([Date]) = YEAR([Date Parameter]) then [Instagram Profile Followers] END), LAST()) /// Returns total followers in month
attempt 3:
{ INCLUDE DATETRUNC('month', [Date Parameter]): max([Date Parameter])} /// Returns followers first day in month (b/c using max date parameter (which is technically yyyy/mm/01)
I'm not totally convinced a solution exists when I would like to create an aggregate by all networks and profiles together, given the latest post for each would be different days. If I could at least get the latest followers for one individual network and profile filtered, that would be fantastic. Any help greatly appreciated.

Related

Last touch marketing campaign view in tableau

In campaign analysis I want to view in Tableau what is the last campaigns that a lead has seen in a particular month and region. A lead may saw multiple campaigns.
For e.g. in sample data set below Lead id abc has seen two campaigns – webnair, email and last one is webnair.
Lead id efg also has seen two campaigns webnair and email and webnair is the last one. Lead id fgh has seen one campaign - Tradeshow
So in filter(month and region will be in filter) when February and US is selected the view will be a bar plot showing webnair as count 2 and tradeshow as count 1. This will give an idea of which campaigns happens mostly before the lead converts to customer.
Had some insights here Campaign performance in Tableau. Tried replicating here with some changes but no luck so far.
Like earlier ones this one is also not difficult.
Create Desired_field by adding a calculated field as
if [Month] = {fixed[Lead Id]: MAX([Month])} then 1 else 0 END
Create a view like the screenshot. (Note: Don't forget to add filters to context!)
Please note that in case of UK, and if FYU the two campaigns are on same date. This will count both campaigns in the view in case of Feb and UK are selected.

Aggregate on day, month and week level

I am making a dashboard with clicks on a daily level and a month level on a certain campaign.
If I have say 1 customer clicking on 2 days then at a daily level that customer is counted twice. However, when I look at the aggregate monthly level this person will be counted once.
My SQL code that I am pulling into tableau is at a daily level. How do I get a monthly level view in the dashboard? When I am creating a parameter with month and day..on selecting month it is just adding the day level numbers to give me the month.
Any advice?
Sounds like a count distinct thing. To get around this the COUNTD would need to happen in Tableau. That would mean you need the Contact ID (or whatever it is you want to count) within the data source. Obviously that would mean your data source is much bigger but is the only way to get an accurate unique count over a custom time period.
Another alternative is to restrict the available time periods for the user and pre-aggregate for those time periods.

Calculate a running total that works with relative date filters

I have a Union table of my various bank accounts to create a personal finance analysis dashboard.
I am trying to make a Running Total to show my total capital available at any given date. Using a Running Total table calculation works, just as much as using a RUNNING_SUM() calculated field. They both work up until I filter the dates. So I am trying to find a way to make the running calculation work without being thrown off by Date Filters (I would like to implement relative dates for visualisation in the dashboard).
My union table has the following relevant data columns:
Order ID: Descending number from 1 for each entry per account.
Date: Date of entry.
Item: Entry name.
Account: Name of bank account.
Amount: +ive for credit or -ive for debit.
Balance: balance after entry value for each given account.
So the table can look like this:
So on 07/05/2019 the Running total should be 229.64.
The running sum formula mentioned above is currently RUNNING_SUM(SUM([Amount])), so if any dates are excluded via filter the running total doesn't add up to the right amount.
A way I can see around the problem could be to get the sum over all accounts of the last balance reading at a given date. The balance is a running total but only if the final entry per time period for all accounts are summed would it work. Would it be possible to make a calculated field that gets the last balance reading for each account at any given date and then sums them?
Or is there a simpler smarter way I am not aware of?
This comes down to an Order of Operations problem. Once you filter the dates the viz doesn't have access to the data anymore.
Your best approach would be to add the running sum to the data source before you bring it into Tableau. Then the running sum isn't a calculated field dependent on the data in the Viz.

Segregate Products based on shipping <SQL>

I have 10 different products (A,B,C),..,J)have multiple purchase dates (by various customers) and delivery dates. I want to see which products have the date difference of less than 5 days. If the date difference is less than 5 days, which products have customer rating less more than 3.If the above criteria is satisfied I want to fetch those products that has the minimum date difference from the queue along with the "Important_date".If there are same minimum date difference for a particular product then I would like to select the top one among the same product in recent times and mark the purchase date as the "Important_date".
The columns in the table are: Product,Purchasedate,deliverydate,date_difference,customer_rating.
I am trying to use case statements to solve the problem in PostgreSQL.
I am looking for an output which will give me all the columns of the table along with "Important_date."

Tableau - Multiple data into one graph, with double dimension on the x-axis

I'm very new to Tableau, and (maybe because of that) struggling with a graph setting. I need to plot a simple line graph showing the ratio between the number of users that returned after registered x days ago and the total number of users that registered x days ago (regardless on the fact that they returned or not). To do this, I have two tables: TableA having (simplifying) USER_ID and DATE_REGISTRATION, and TableB USER_ID and VISIT_DATE. Both table are joined by USER_ID.
I'm able, of course, to plot each individually (i.e. count distinct of USER_ID with DATE_REGISTRATION on the x axis to get the number of new users registered per day), but not able to combine them. I guess the problem is that I'm using either DATE_REGISTRATION or VISIT_DATE on the x-axis, but in this case I can get one or the other info, but not the two combined.
Ultimately, I would like to be able to have, for each date, both the number of users visiting and the number of user who registered.
Thanks a lot in advance.
Raffaele
Well, problem is your database is not ready to generate those analysis. Your table is user_id oriented, meaning you can do lots of analysis centered on the user_id. To do date oriented you need a table like:
Date User_id Type of event
01/01/2014 1234 Registration
02/01/2014 1234 Visit
Then you can drag Date and Type of event to Columns, and COUNTD(User_id) to rows, to get a bar chart that will show, for each day, how many people registered that day and how many people visited that same day.
Additionally, you can still join this table with the one you have, to have the registration date for each user_id. That way you can, for instance, calculate how many days have passed since registration.