Tableau Customised FIlter - visualization

Below is the screenshot of the visualization that I have been working on.
I need a small help/advice/guidance regarding one Customised filter.
A small detail on the X and Y axis of the graph. X axis contains distinct DRG Codes while Y axis contains its respective average cost. The color indicates the 4 severity levels (1,2,3,4). 0 is null.
I need to filter and keep only those data which are above that Average mark in Grey. I need the filter to work for all the Severitys at the same time, like the AND operator. You can see such an example for 1,2,3,4,5 DRG Codes. There all the severities are above the average mark. I wrote something like -
IF [APR Severity Of Illness Code]==1 AND [MeanCost.mean]>29863 THEN [MeanCost.mean]
END + IF [APR Severity Of Illness Code]==2 AND [MeanCost.mean]>29863 THEN [MeanCost.mean]
END + IF [APR Severity Of Illness Code]==3 AND [MeanCost.mean]>29863 THEN [MeanCost.mean]
END + IF [APR Severity Of Illness Code]==4 AND [MeanCost.mean]>29863 THEN [MeanCost.mean]
END
which obviously didnt work out.
It works when only one condition is given, something like -
IF [APR Severity Of Illness Code]==1 AND [MeanCost.mean]>29863 THEN [MeanCost.mean]
END
but the filter returns null values when more than one condition is given. Please help.

pragyanbezbo, assuming you have Tableau v9 or v10, you could use Level of Detail (LOD) expressions introduced in version 9 last year:
{ FIXED [APR DRG Code], [APR Severity Of Illness Code] : AVG([MeanCost.mean]) } > 29863
This should return TRUE/FALSE and work just fine. I'd maybe suggest replacing the hard-coded mean value (29,863) with dynamic formula using LOD, but I am not sure how the filters are applied and it would probably require some more details to get it right, but I think this should be enough to point you in a right direction.
Here is the link to LOD Overview. And some Jedi LOD examples. Hope this helps.

You probably only need one IF statement.
If [MeanCost.mean] > {fixed : avg([MeanCost.mean]) } then 'show' else 'hide' END
Create a new calculation as well for a new reference line, this is calculation2 in the sample workbook.
{fixed : avg([MeanCost.mean]) }
This is because if you filter out the "hide" values, your current reference line will move to show the average of all your "show" values.
Now place your filter and select 'show'.
Sample attached. https://dl.dropboxusercontent.com/u/60455118/POC%20Req%203%20-%2023%20Sept.twbx

Related

How to put color for the whole cell

I am trying to color code my list in tableau with red color for dates in end date lesser than today() or when concern column is Yes. I created a dual axis of 1 and 0 to get the cells with color in one column and get the text in another and created a dual axis so that they overlap. For that I created a calculated column where I gave the color red if the conditions meet.
This is in my calculated field:
Color:
IF TODAY()>[End Date] OR [Concern (Yes/No)]="Yes" then "RED"
ELSE "None"
END
However even after totally maximizing the size of the square for color for 1. The fields do not fill the whole cell. How do I fill the whole cell?
Here is the pic:
Please help me out here?
You may have 2 options here. I haven't tested so will leave you to see what works best.
Option 1 - use a measure and a Square mark type. Create a calculated field that returns a measure. We can adapt the formula you have built:
INT(TODAY()>[End Date] OR [Concern (Yes/No)]="Yes")
Put that field on Columns - aggregate to either MIN or MAX, doesn't matter - and set the Mark Type as Square. Also put this field on Colour and set your colours accordingly. Put your text on the Label shelf (or Text, I forget what it's called with the Square mark type.
Option 2 - similar to what you have now. You don't need MIN(1) and MIN(0), just one of those should suffice. Make it Gantt, the above calculated field on colours and your text field on Label. This article on the Tableau placeholder technique describes how to do this.

How to make a 100% Stacked Chart with 2 measures in Tableau?

I am using Tableau to create a productivity progress bar of actual work done, versus the goal for that day. I have gone through numerous resources, but none seem to apply to only using 2 measures, basically putting the actual data measure turned into a percent within the goal measure. I have the chart working by using a calculated field of Missed Goal ([Goal]-[Actual]) but I am wanting into to look like a 100% stacked chart. Here is a picture of what I have, I just can't seem to get the last step expanding the bars horizontally to be a %100 chart:
Currently looks like:
Wanting it to look like:
Thank you for any help!
This is a good candidate for a few LOD Calculated Fields.
I will give an example based on the SuperStore dataset where [Profit] is a percentage of [Sales]. This can be extrapolated to your use case.
Because you have two dimensions on the view, both will be needed to be accounted for in the LOD calculations below:
//LOD Sales
{Fixed [Segment], Year([Ship Date]): SUM([Sales])} / {Fixed [Segment], Year([Ship Date]): SUM([Sales])}
We will always want [LOD Sales] to equal 1 for bar-chart display purposes.
//LOD Profit
{fixed [Segment], Year([Ship Date]): SUM([Profit])} / {Fixed [Segment], Year([Ship Date]): SUM([Sales])}
This will create the percentage of [Profit] to [Sales].
From there, you'll want to turn off Stack Marks so the bars overlap eachother:
Analysis Menu > Stack Marks > Off
And probably change the axis display to a percentage:
Right click [Measure Values] > Default Properties > Number Format > Percentage
For simplicity, your existing filters should be placed 'On Context' as to not interfere with the LODs. (Please read above linked article for reasoning and alternatives.)
Right click on Filtered Field > Add to Context
The end result should look like this:

Tableau: Output grouped data in different graphs

I have a data set (let's assume it's students and scores) in Tableau.
I have used the Rank_parcentile() to rank them:
Rank_parcentile(sum([score]))
I then use the following code to group the students:
IF [percentile] > 0.8
THEN "Top 20%"
ELSEIF [percentile] <0.8 and [percentile]>0.5
THEN "Mid 30%"
ELSEIF [percentile]<-0.5 THEN "Bottom 50%"
This works very well and groups them as so. The problem is that sometimes I have too many students and they can't fit in a single graph reasonably.
Is there a way to divide the top 20% in one graph , the mid 30% in another and the bottom 50% in another?
Thanks in advance :-)
An easy approach is put percentile on the filter shelf. Show the filter, and then interactively switch between the three groups of marks -- all on the same chart
Alternatively, you can use a similar calculation to make a trellis chart.

Calculating % Complete

enter image description here
From the Image I need to calculate % complete for the order number 1.
Calculation for complete will be
(total number of points for status 'Delivered' / total number of points)*100
The value should be 57%
Can some one help with the calculated field?
Look at IIF in help files
SUM(IIF([Status]="Delivered",[Point],NULL)) / SUM([Point])
I assume your column named Order No. extends all the way down each row (i.e., each row should have a 1 as Order No. but the screenshot does not show that.
Also, the above only works if the status of "Delivered" is consistently cased, which it is not in the screenshot. If it is not consistently cased, wrap [Status] in an Upper function:
SUM(IIF(UPPER([Status])="DELIVERED",[Point],NULL)) / SUM([Point])
You can also get the effect you want, just by manipulating the Tableau user interface -- without needed to write calculated fields as #S. User18 showed. Both approaches work, but it helps to understand both alternatives.
As with #S. User18, I assume your column named Order No. is consistently filled in. I also assume [Order No.] is a dimension.
Place [Order No.] on a shelf, say Rows
Place [Status] on another shelf, say Columns
Place Sum([Point]) on a shelf, say Text
This shows the sum of the number of Points for each combination of the two dimensions: [Order No.] and [Status]
To convert the number of Points to a percentage, right click on Sum([Point]) on the marks card, and choose Quick Table calculation->Percent of Total
Similarly, right click on Sum([Point]) and experiment with different "Compute Using" settings to get the effect you want -- i.e. percent of each row, column, table etc. You can instead Edit the Table Calc if the preset Compute Using options don't get the effect you want.
Right click on any row or column headers that you want to hide - so if you only want to display the percentages for the Completed Status, hide the others. Don't exclude the others as that will change the calculations.
To understand more about Table Calculations, see the online help.

kendo chart bar type series combined with line type series the chart reverts to a column type series

I'm trying to add a line type series i.e. "series.Line(s=>s.Name("goal")" to a chart -- this is being used to show a threshold of sorts. The remaining series are bar types series: "series.Bar(s=s.Name("Rate1") and "series.Bar(s=s.Name("Rate2") and "series.Bar(s=s.Name("Rate3") and so forth. If I remove the "goal" line code then the chart renders as horizontal bars as expected; however, if I include the "goal" line code then the chart renders as vertical columns (the default I assume). Any suggestions?
I think you're missing understanding something here.
A line will travel from left to right showing (normally) the progression of a value (normally over a period of time). meaning that their zero value with be on the horizontal axis.
The Bars have a zero value on the Vertical axis.
Therefore the 2 series types are incompatible. Therefore, Kendo changes the chart from "Bar" to "Column".
So basically, what you're looking for is a Vertical Line series type (which I don't think exists).
You may want to look at showing these as Bullet charts instead.
http://demos.kendoui.com/dataviz/bullet-charts/index.html
According to Telerik:
The chart item does not provide built-in support for Pareto chart, in
other words the chart item would not be able to make the percent
calculations for you and you should take care of that prior to binding
the chart. When this is done you can achieve the same functionality by
combining Bar and Line series types. To create a second Yaxis
marked from 0% to 100% try the following code snippet:
chart1.PlotArea.YAxis.AutoScale = False
chart1.PlotArea.YAxis.AddRange(0, 100, 10)
chart1.PlotArea.YAxis.Appearance.ValueFormat = ChartValueFormat.Percent
Here's an example of how to calculate percentages in advance using MySQL:
SELECT a.`Year`, #count := (a.`count`) AS `Count`,
#total := ROUND((#count)/(SELECT #total := count(`year`) AS `total` FROM `table` c) * 100, 2) as `% of Total`,
#cumulative := (#total + #cumulative) as `Cumulative %`
FROM (SELECT #cumulative := 0, `year`,count(`year`) AS `count` FROM `table` `data` GROUP BY `year` ORDER BY `count` DESC) a
ORDER BY `Count` DESC;