Spotfire calculated column based on filter - dynamic

I want to create a calculated column that is equal to the percent of the total of the previous column, but only for the rows that are selected.
For example, the two columns below show rows where I've filtered for only the rows of interest. The sum is accurate, but I want the percent of the total to be only out of sum of the currently selected rows rather than the absolute total (which is how it's currently being calculated). I want the percent of the total to dynamically change depending on what is filtered in the data table. Is this possible?
Image of my 2 columns:
I know spotfire somehow calculates this becuase when I insert a bar graph using % of Total(SumofComponents) the ratio is only out of the current total.
Image of my bar chart:

much like in programming, Spotfire has a rough concept of scope. and unfortunately, calculated columns are above filters in terms of scope; they have no concept of what is and is not filtered.
visualizations themselves, however, do*!
what you can do in this case is to put your expression on the Y axis (it looks like you've done this), and it will respect your selected filters*.
*caveats: there are a few ways that filtering can be negated on a given visualization:
Properties>>Appearance>>Show shadows indicating the unfiltered data. this option shows a grey bar that represents the data hidden by whatever filter selection was made
Properties>>Data>>Limit data using filterings. these options allow the viz to use separate filtering sets ("Filter Schemes" as they're called in Spotfire) or none at all (to ignore filters completely)
Properties>>Subsets. by default there are three subsets: "All Data" which ignores filters, "Not in current filtering" which inverts the filter selection (e.g., if you filter a boolean column to show only TRUE, this chart would show only FALSE), and "Current filtering" which is the default behavior. you can check the online help for additional subsets that you can add.

Related

Expression chart colors depending on the dimension for no selected values

I was planning to do a Straight Table chart like this:
The four dimensions should always appear and have exactly the same colors (the only variation is the expression values).
What I have now is the dimensions and the values as I want except for the colors. The initial data is organized in a table like:
Project Status
1 Completed
2 On Track
3 On Track
4 Deviating
So the #RA variation is the percentage of each status value from the total. However, it can happen that in some cases one status value is 0. And I get this:
The condition for the colors is set in the color background expression, like this:
I also have to say that as some fields of the dimension have no values they disapear, so they are forced to appear using the Show All Values in the dimension tab.
Any one knows how to make the colors always fixed for its dimension even when the value is null?
Thanks for the attention

Redaction in Tableau

I am currently in the process of building some Tableau workbooks where we will need to redact visualizations or text tables if the results fall below a certain threshold (e.g. only ten data points are returned after filters are applied). Does anyone know how to create calculated fields or know of other methods to redact in Tableau?
You can create a threshold filter that compares the number of filtered responses to a threshold value set in a parameter.
First, create a parameter with integer data type and set it to the desired threshold. In this example, I called it Count Threshold.
Then create a calculated field for the filter with an equation like the following:
{FIXED: COUNTD([Respondent ID]) >= [Count Threshold]}
(I did this for survey results where we needed to hide results if the filtered number of respondents was fewer than 10.)
For the threshold filter to be applied after your other filters, choose "Add to Context" for your other filters.
I found a partial solution on the Tableau community forum/knowledgebase about redaction that might work for other implementations.
The basic idea is to create two different calculated fields, one which displays a integer value and the other that displays a string value. That way, when both are concatenated in the display you get the desired output without breaking any of the calculated field rules.
So create a calculated field that has a formula like:
IF sum([Datafield_to_Redact]) < 10 THEN "*" ELSE str(sum([Datafield_to_Redact])) END
And another that has a calculated field that has a formula like:
IF sum([Datafield_to_Redact]) < 10 THEN null ELSE sum([Datafield_to_Redact]) END
In the post the attached workbook and screenshot show how the two values are concatenated in the Text mark.
Workbook screen capture

SSRS Dynamic Graphs

Does anyone know if it is possible to create a graph(s) at run time based on the dataset?
To clarify, I have a count of patients suffering from a health condition, split by week. I need to make a graph per condition with weeks on the X axis and patient count on the Y. Nice and easy so far.
The problem is that the number of conditions displayed in the dataset will be different depending on the values entered for the start and end dates for the reporting date range.
With this in mind can I create a single graph then tell it to replicate once for each condition returned and only look at the data for that specific condition?
The graphs can't appear in rows as they must aggregate data from multiple rows (where the condition is the same) and plot the various count values over week numbers (the dataset returns a count, a week number and a condition with a group by on the week number and condition)
As an added challenge none of this can be hard coded as the single report has to work across multiple sites.
Thanks
P
Yes this is possible by first dropping a "Matrix" control into the report surface. With the Matrix control, you're able to display groups of data. In this case, your group will be the condition returned in your DataSet. Each group will have an embedded chart which will display data the same way, but only the data within the grouping you choose.
Step 1: Add a Matrix control to your report surface. Create a Row Group based on Condition (In my example, Year)
Step 2: Right Click the empty column on the right side of the Matrix control, and choose the option for Insert Column > Outside Group - Right. Then Delete the middle column.
Step 3: Right click the Right columns "Data" cell (which should be outside the grouping) and choose Insert > Chart. Select the desired chart type.
Step 4: Resize the column and row to view the chart in more detail. Edit the Chart Data to aggregate what you're wanting to show as the line, and pick your category groups.
Step 5: Test, and revist whichever step above needs adjusting.

How to display filtered data rows as a tooltip in Tableau Public?

Noob here, I have a table with different entries (rows) per different (repeating) regions.
I'd like to be able to display the data rows filtered - matching that particular region thanks - so I get those particular fields related to each region as a tooltip on a map. (I know how to build the map)
Thank you
Just dragging the fields you want to Details or Tooltip is not doing the trick?
Putting a measure on a shelf (other than filter shelf) includes that field in the visualization query results -- i.e. applies the chosen aggregation function to yield an aggregate result value for each partition of the data (as specified by the unique combination of dimensions)
Putting a dimension on a shelf (other than the filter shelf) also includes that field in the query results, but since the dimensions define how data rows are partitioned, it can affect the level of detail of the query. You'll notice this often as suddenly getting many more marks in your visualization after you add a dimension to a shelf. If you are familiar with SQL, dimensions define the fields that follow the GROUP BY keyword.
EDIT
Thanks for the addition, #AlexBlakemore. I've never said dragging a dimension would not work, only that it wouldn't work as the OP wanted it to (basically the same as you're saying).
And though everything you said (above) is true, it's particularly not exact when it comes to maps. Yes, dragging a dimension will further partition the data, but it will not create additional marks on a map (unless it has also geographical properties). Rather, the tooltip will get the first occurrence of that dimension, and display data for that only. For instance, if you drag "Product" to details, and the possible values are "Bread", "Coffee" and "Milk", it will probably just show "Product: Bread", and the measures for "Bread" only. So yes, it will partition, but no, it won't create additional marks.
Back to OP problem. What I believe you want is a tool tip with all values of the dimension (in my poor example you'd like to see "Bread, Coffee, Milk"). Tableau does not have functions to aggregate strings yet, so it's hard to do so.
What I would suggest is to create a separate sheet, and just drag the dimensions and measures you want to rows. Then put it side by side with the map on a dashboard, and use the map as a filter. Then, when you click on a country/region/city, you'll see the data of that region on the other chart.
Refer to: http://kb.tableausoftware.com/articles/knowledgebase/creating-filter-actions-dashboards
or https://www.tableausoftware.com/learn/tutorials/on-demand/authoring-interactivity

Qlikview Expression to get Average in comparison to selected criteria for Chart

I am trying to create a chart that displays the average of a parameter of an entire category. The problem is that in sheet 1,2,3,4, etc, the charts I have reflect one parameter, so when I go to compare this parameter to the average in my new sheet, I only get the average of the fields that have been selected in prior sheets. I want it so that I can create a new chart with one bar as an average of the entire population, and another bar in the same chart that depicts the average of the selected parameter(s). Ideally, I would have two dimensions/x axis categories, one for the selected criteria, and one for average of all categories. Can someone help?
Thanks.
I believe the way to handle this is with set analysis. You can create one expression with the normal avg(parameter) and another expression with some embedded set analysis. See example below.
Expression1: avg(parameter) // will agregate everything in the current selection
Expression2: avg({1<category='YourCategory'>}parameter) // will aggregate everything in a category that you set in the set analysis syntax.
With some more specific info I would be able to get you an actual expression, but hopefully this helps.
EDIT
Updated to reflect new information provided in the comments.
Expression1: avg(parameter)
Expression2: avg({1}parameter)
In set analysis syntax the {1} means the entire universe of data where as {$} is your current selection. In other words, 1 is your data with nothing selected. In my first example above, the {1<category='YourCategory'>} statement uses a modifier signified by the <> so that you would be performing the aggregation over the entire universe with only the value specified in YourCategory selected.
So if the scenario is that you have currently selected let's say, 5 zip codes, your current selection ({$}) would be those 5 zip codes and the entire universe ({1}) will be as if you selected no zip codes. Therefore comparing those two populations side-by-side in two Expressions should give you the comparison you want.
Caveat: Using the {1} syntax in your expression means that your average of "all zip codes" will always be the average with nothing selected unless you put something in the modifier as in my first example. See this more detailed explanation.