You're going to have to upload a workbook.
You're following the right template if you're doing the method in Jonathan's example. But somewhere in all the machinery you're going to have to add in logic to exclude names that don't fit the criteria for that mark.
The PREVIOUS_VALUE function is a table calc. It traverses the whole table. You want to look at what conditions you want to include in the final output string.
It might just be a matter of specifying a RESTART on the table calc. But without a concrete example, I can only guess.
Sadly, because I work at a hospital, all our information is confidential. I'll have to create a sample worksheet that simulates my problem.
Here's what I did. I took Jonathan's example, deleted all the other sheets. I put a filter on the sheet to exclude any rows for "Furniture" AND "Small Box" so that we would have differing contents from Department to Department. I had that workbook saves as 8.2, so I just did this work in 8.2 as well. It will upgrade to whatever version you need.
I changed the two table calcs to RESTART for every Department.
(As it turns out, "Office Supplies" doesn't have any blue (Jumbo Box) so I really didn't need the filter.)
Now, you get in tooltips only the list of containers for that particular Department.
You'll want to do a similar thing in your workbook.
Thanks for sending that but I'm fairly new to Tableau and don't really understand what you did... How did you change the two table calcs to RESTART for ever department??
Attached is my sample workbook so you can see what I'm dealing with.
Tooltip Problem Example.twb 18.7 KB
You have to upload a twbX file. Do FILE --> "Export Packaged Workbook" to make a twbX file.
And let me know what version you are using.
This is going to take some additional work. One thing that differs between your sheet and Jonathan's is that you don't have [Pat L Name] on the sheet, which is what you need to cycle through. I'll have to look at this tomorrow.
Jonathan Drummey -- am I correct in assuming that to cycle through a dimension in the underlying data for making the string list using PREVIOUS_VALUE (sheet 15 in "The Next N Table Calcs") we have to have the dimension in question on the sheet?
In trying to get Theresa's sheet to work, I put Name on the sheet. (If this is the route she'll have to go, we can get the viz we need with table calcs and INDEX=1 in the filter.) But I simply cannot discern the proper table calc settings to get counts of 1-n in each bar. Attached is a sheet (Sheet 7) after a million stabs at it. If I can get 1-n, then I can also get INDEX=1 and pump out just one value and have the colors and all (half way there on Sheet 8). Then I cam make the String List calcs cycle the same way, and off we go.
But I simply cannot make INDEX cycle correctly here. I usually can get these to work, but not this one.
BTW, the workbook attached is 9.1. I don't mind if you figure something out in 10.1 (if you no longer have 9.1.) I can apply it to my 9.1 workbook for Theresa.
Tooltip Problem Example A.twbx 36.1 KB
Something that uniquely identifies every encounter/case (such as the Case Number) should be on the worksheet for two reasons:
1) As you surmised it's necessary to make the PREVIOUS_VALUE() calc work. If you want more details on the "why" of this I just put a bunch of details in another thread where the underlying principle is the same (needing to increase the vizLOD so a table calc can work): Re: Replicate VAR functionality through Script_real. We can hope that someday Tableau will give us an aggregate function that can concatenate across rows without having to jump through so many hoops.
2) Multiple patients can have the same name. (I live in an area with a lot of people of French-Canadian descent where many people have the same last name like Cote, Jacques, etc. so we saw this multiple times a year in the hospital). So we'd want to show John Cote twice two indicate two patients rather than just once if we used just the Name as a dimension.
This increases the viz level of detail so your Index calculation isn't working as expected (though the compute using could be set appropriately) and the COUNTD() is returning 1 for each patient, and you're getting a mark for each patient. The ideal view has one mark per month/complication so the vizLOD (w/Case Number, Month, Quarter, and Complication) is not the desired displayLOD (which is really just Month, Quarter, and Complication). To make it all work here's what I did in the attached workbook:
1) created custom dates for the quarter & month.
2) Created a workout view with the custom date dimensions on the Level of Detail Shelf and ATTR()'ed versions of those on Rows, along with the Complication Text & CaseNumber. The reason why I did that with the dates is to avoid complicating with Tableau's date densification behaviors (we can work around them with Advanced Compute Usings in our table calculations but I find creating custom dates much easier to build, explain, and maintain). Setting up the workout view this way enables me to see all of the addressing and partitioning and table calc results in an easier-to-debug crosstab view.
3) Added the Patient Name Tooltip, Index, and a new # of Patients calc using SIZE() as the formula to the view all with a Compute Using on the CaseNumber. SIZE() is a calculation that returns the number of addresses in a partition, so it acts like a COUNTD() for the partition. Here's the workout view:
Then I duplicated this view and rearranged pills and turned off tooltips on appropriate pills (there's still some formatting to do on the dates):
At some point we'll get the announced viz-in-tooltip feature and this will be much easier to create.
In the meantime an alternative view that doesn't require any calculated fields or mucking around with table calculations abandon is entirely drag-n-drop would be to set up a simple bar chart w/out the casenumber/patient name in the vizLOD and then a separate tabular worksheet, put those two in a dashboard then set up a hover action, here I've hovered over the July 2015/CF mark:
Let me know if you have any questions!
Tooltip Problem Example A jtd.twbx 262.1 KB
Jonathan Drummey == You showed me something. The key was the custom dates. I was trying all sorts of combinations of compute-using and at-the-level with the original date fields. Changing these pills to custom dates makes everything I was trying earlier work smoothly.
Changing them to custom dates did the trick.
Theresa -- See attached.
Sheet 1 is your original. Sheet 2 adds [L Name], and changes quarter and month to custom date calcs. (Right click on [Day of Surg],choose Create, and then custom date.)
Sheet 8 changes the COUNTD pill to a table calc. (SIZE() tells us the number of rows in the bar.) Right click on that pill in the text shelf. Select EDIT TABLE CALCULATION. You will see that I selected [L Name] for "Compute using". That tells Tableau to run the calc along the [L Names] in the partition. We will be using that same setting for every table calc we use in this example. Notice that we're still getting multiple copies of the value -- one per patient in each bar. We will distill that out later.
Sheet 9 -- CTRL-Dragged my table calc from the text shelf to the colors shelf. CTRL-drag keeps the original in place, but adds a copy to the new location. This also preserves the table calc setting to run it along [L Name]. You'll see that the bars are now colored the same as you have in Sheet 1.
Sheet 10 -- I CTRL-Dragged the calc to the ROWS shelf and placed it on top of the COUNTD pill that was there.
Sheet 11 -- Here is where we make one value per bar. The values that were in the multiple marks per bar are identical as I pointed out earlier. We really only need the first one in each bar. I created a calc [Index]. It is simply the INDEX() function. I placed that on the filter shelf and clicked OK to the initial default. then I changed that pill to run along [L Name] just like all other table calcs in this exercise. When you make that change, Tableau asks you to select the value(s) you want. Select for value = 1. I do it by setting minimum and maximum to 1. Now Tableau will show us only the first mark for each bar. At this point we have essentially re-created what you had in Sheet 1, but accounting for [L Name] being on the sheet.
Sheet 12 -- Drag the [... tooltip] calc to the tooltip shelf. Right click on the pill and select Edit Table Calc. This part is a little tricky. Select [L Name] for Compute Using. Then, at the top of this dialog box you will see a pulldown set to [Patient Name Tooltip], You don't have this pulldown on any of the other table calcs, but it is here because this table calc is based on another table calc. Pull down and select [... Feeder]. You need to set this calc too. Again, set Compute Using to [L Name].
Now look at the tooltips. This was the result I was aiming for last night. I knew it would work, but it took Jonathan to unlock the key to making it work.
And after having explained all that, I want to make sure you look at the dashboard in Jonathan's example. It is another way to address the visualization you wanted to achieve, and it's rather elegant. Rather than putting the names into tooltips, it displays a whole other sheet that pops up as you scroll over any bar.
Tooltip Problem Example X.twbx 52.6 KB
Thank you so much for your fabulous example outlining how to view specific data in the tooltip and in a list format. Using your directions, I was able to do this in my own data set. However, I ran into a snag when I wanted to change my bar graphs to percentages rather than counts.
Would it be possible to view the data in the tooltip and in the list view (Tooltip Problem Example X.twbx) but see the bars as percentages rather than count?