Histogram in tableau - histogram

In campaign analysis in a B2B set up I want to see how many days an organisation takes to convert from lead to customer after seeing a campaign in the form of an histogram.
Below is the sample data set where there are multiple lead underneath an organisation.
--For e.g organisation abc has three leads- Bill, John and Sam. Sam is the last one to see the campaign amongst all three i.e. on 14/9/2020 on campaign date column and converted on same day. So for organisation abc it took 0 days to convert. Here we are considering the last campaign date for a given organisation to create time to conversion view in the form of histogram
--Organisation efg has two leads - Don and Harry. Harry is the last one to see the campaign on 18/9/2020 and converted on 19/9/2020. so organisation efg took 1 day to convert.
-- Similarly organisation pqr took 0 days to convert.
In filter I want to have converted date and region column so when sept is selected in converted date and US on region filter then a histogram view should come up couting 0 as 2 and 1 as 1.
I created a calculated field which capture the max of campaign date for a given organisation ID
if [campaign date] = {fixed[organization id]: MAX([campaign date])} then 1 else 0 END
But not able to create the view in the form of histogram.

You have nearly reached the solution..
Step-1 create a T/F condition so that your criteria is met
[campaign date]={FIXED [org id]: max([campaign date])}
Step-2 convert your field days to convert to both discreet and dimension.
Step-3 you have a large number of vraiables under this column, you can also create bins of appropriate size (OPTIONAL but this will give a proper histogram look to your chart)
Step-3 (I have not created bins so repeating step-3) add COUNTD(org id) to view, region filter to context, and cond filter to TRUE you'll get a view like this
if you'll proceed without creating bins, values of days to convert where no organisation meets the condition, will not show up, while if you have large distinct values in 'days to convert' creating bins will line them up neatly.

Related

How to check if dimension value is available on all days in tableau

I have two input dimensions i.e. Day and Product_sold and I want to create a calculated field "Flag" in Tableau. Basically Flag will show "Yes" if the product was sold on all days, else No (see example attached), can you please help? I have tried multiple things but no use
You can create a fixed LoD calculation to count distinct number of days in data. Then used another fixed LoD (or possibly a table calc) to count distinct days for each product. If the product COUNTD = dataset COUNTD than it sold on every day.
What have you tried so far? This looks like a simple attribution calc that could be put together as boolean eg:
Product_sold = 'computer'
Steve

How to iterate cells in a Google sheet formula?

I'm creating a solution to automatically detect conflicts in a schedule created with Google sheets. A "conflict" means that in the same day at the same time different lessons are supposed to have same teacher or to be in the same room. For instance, in the table below groups 1 and 2 are supposed to be in room 2 at the same time, which should be indicated as "conflict".
Monday Tuesday ...
room subject teacher tutor room subject teacher tutor ...
(group1)
09:00-10:00 1 math Smith Black
10:00-10:45 2 science Stones Moore
...
(group2)
10:00-10:45 2 math Smith Taylor
10:55-11:40 1 reading Anderson Harris
...
To check if there are any "same teacher" conflicts, I've added the following formula:
=if(OR(ARRAYFORMULA(D7={D19;D29}));"at this time teacher has another class for _ group";"ok")
However, such solution has some drawbacks.
The main one is: the {D19;D29;...} array is formed manually which is not nice, at least very fragile. If a line is added in the middle of the schedule, most of the checks will break. What I want to do instead is to get the necessary lines by filtering those with the same time in column A and then get cells D to compare.
Another one is, I can't get (and show) the "conflicting" group which this teacher also is supposed to teach (unless I manually create another array, corresponding to {D19;D29;...} which is more manual work), see _ in the formula.
My question is, can I create some form of loop/iterating in Google sheets to deal with this issues in some convenient coding manner? Or may be you'd suggest another approach to this?
There is a tab on the sample sheet called Conflict Finder (Simpler) where you will find this formula in cell G3, and a very similar one in H3.
It counts instances of a common timeslot and teacher name and if it's more than 1, it outputs the word "Conflict"
=ARRAYFORMULA({"Teacher Conflicts";IF(COUNTIFS($A4:$A;$A4:$A;D4:D;D4:D)>1;"Conflict";)})
Once columns with the array formula are created, you can apply conditional formatting with custom formula to highlight the conflicting cells and hide the auxiliary columns. For instance, for range D4:D1000 apply =LEN(G4) to give red background (in fact, range D4:E1000 also works since column H contains conflicts for column E).

subtotal with product condition after applying date filter on google sheet

I am struggling to find the right formula for my table. I have a database that I want to filter per date and get the total of each product on a different page.
As I need to prepare these products per day I would like to avoid counting every product by hand.
I have this formula =SUMIF(E40:E52,"Reese - box of 4*",D40:D52)that work without filter.
How can I do this function with filter?
image
My second question is about when an order as more than one product.Like here, we have a box of 4 that contains the product behind.
image
How can I get a count of the total number of each product, applying the filter option as well?
Thanks a lot for your help!

Machine learning model with varying input shape as time changes

I am trying to predict the bookings of a stand-up comedian cafe. There are a lot of features I can use which have an affect on the number of sales. (e.g. day of the year, weather, average sales last month, day of the week, average sales on the specific day of the week etc.)
However, one of the features that most correlates with the actual number of sales is the number of tickets already sold before the deadline. The customers are able to start making reservations 120hours (5 days) before the actual deadline of ordering (11:00 AM on the same day of the show).
I would prefer to use this data as input for my machine learning algorithm. Currently I created 120 columns in the dataframe. The columns define 120 hours before deadline untill the deadline itself. Column "hour_98" therefore shows the accumulated sales 4 days before the deadline. Column "hour_24" shows the accumulated sales 24 hours before deadline etc.
If I now would like to predict the sales 24 hours before deadline the columns "hour_24" until "hour_0" are all given "NaN" values. Since algorithms can't deal with NaN values I currently give these columns a value of 0. However, I tihnk this is too simplistic and will result in bad prediction model.
How do we deal with a changing input shape since we obtain more data if we get closer to the deadline of ordering?
Now from what I understand, you have a fixed number of columns, each representing the data from a predefined hour before the deadline. So in a sense the input data shape never changes, only the validity of some input features changes.
Provided you have a fixed input shape, with changing validity of the features (NaNs),
you can get around that issue by using a mask for each input feature.
For example a valid hour_24 can be represented as hour_24 = 20 and mask_24 = 1, and an invalid hour_24 can be represented as hour_24 = 0 (or whatever) and
mask_24 = 0.
The algorithm itself will need to learn where to ignore a given feature in respect to the related feature's mask.
This answer explains in more detail how to mask input.

How to reflect multiple cells based on specific criteria

Imagine a list on the left filled with employees going down the spreadsheet and headers across the top based categorized on infractions that an employee might violate. this sheet is connected to another sheet which adds a one every time a form is submitted against the employee adding up for the quarter. So employee john smith has across his row would show a 0 if he never committed this infraction and add a 1 to the column each time he did so a row might look like this. John Smith 0 4 5 0 1
The goal is to show the experts name and infraction with how many times this infraction took place removing the infractions that he did not commit so ideally it would look like John Smith 4 5 1 and the header of each number would show what he did.
The goal is to make it much easier to see who did what essentially. There will be over 100 employees and alot of 0's so optically it would look better to distill in order to quickly identify who did what and how many times.
Any ideas?
V lookups and important ranges based on if this is greater than 0 is tedious and does not exactly pull what we want. Essentially omitting the 0s and just showing what an employee has done rather than what they have not done is the goal. All index and match formulas do not seem to specifically answer this problem
simple Index V lookups and matching formulas have been tried
Not able to reflect all three variables (employee/frequency/infraction) while not showing on a master list the people who did not commit the offense
There's a few ways you could set this up. I would set this up so it
Column A = Employee
Column B = Infraction
Column C = 1
Column D = Date
That way you can do a pivot summary and have the employees, with their infractions below their name and the months/years they occurred. Also you can adjust this table as necessary, such as filter by the employee name or by date or by infraction.
The added benefit is you could create a chart with all of these as filters, like cutoff a date range or pick an employee or infraction and it can show a bar graph of all the infractions by month or something like that.
I would agree that listing your data of infractions line by line (as they happen) and using a pivot table would probably be the easiest.
You could also use the AGGREGATE function to pull from a large database as well. This way you could type in an employees name, and a list of all infractions would pop up next to the name (or wherever you would want it) with as much detail as you would like. This way is more complex, but using both a pivot table and the AGGREGATE function might get you the best of both worlds (you could searching infraction types, dates, employees, employee types, and get all the details in the world if wanted).
Hope this helps!
JW

Resources