Spotfire - KPI of multiple Boolean columns that can limit data - datatable

In the data I have there are multiple Boolean columns that categorise each row, for example:
Object
Fruit
Yellow
Round
Chair
FALSE
FALSE
FALSE
Banana
TRUE
TRUE
FALSE
Apple
TRUE
FALSE
TRUE
Ball
FALSE
FALSE
TRUE
I am trying to make a KPI chart that would go alongside a table of this data in which it would have 'Fruit', 'Yellow', & 'Round' as categories and a count of how many are true, so that when you click on them it will mark and limit the data in the table. In this example 'Fruit' would have a count value of 2, 'Yellow' 1, and 'Round' 2.
How can I make a single KPI chart look at multiple columns and count their True values? I tried making a second data table to unpivot the columns into rows and have their count, which works, but then I am unsure as to how to make a relation between the two table such that I can mark and limit the original data table?
Please let me know if you require any information. I am using Spotfire 10.10, and this is how the data is presented to me, I cannot change it.

Related

Get the count of repetition of values for a column in Qlik Sense

I am new to qlik sense, I have a data say - 'data', it contains four columns - 'name', 'amount', 'category', 'mode'
'name' is basically customers name, 'amount' is total spent, 'category' is like - cloths, foods, gadgets and 'mode' is offline or online.
I have created a drill down bar chart with x axis as - name/category (drill down) and y axis as amount(sum). I need to show the count of repetition in two kpi charts of mode upon selecting a particular bar
for eg - If I select the bar of foods, the kpi will show offline - 32, online -7 based on the selection I made i.e., foods
I have tried - Count({<mode={'offline'}>}mode)
but it's not working. Any help will be appreciated.
When using drill-down Qlik is actually selecting the values, which are "drilled". You can see that selections are made in the selection bar.
You can build the KPI objects based on the number of selected values into the drill-down fields.
GetSelectedCount function will return the number of distinct selected values in a field. The function will return 0 if nothing is selected.
An example expression:
= if(GetSelectedCount(category) > 0,
count( {<mode = {'offline'} >} category),
if(GetSelectedCount(name) > 0 ,
count( {<mode = {'offline'} >} name),
count( {<mode = {'offline'} >} SomethingElse // if nothing is selected in "name" and "category" fields
))
)

Tableau - Filter Measure Based on Different Variables of the Same Dimension

I have the following dimensions: Patients and Collection Type (Blood or Tissue). Measure: Collections.
I am counting how many blood and tissue collections for each patient have been made.
Here is my table: Collections per Patient by Collection Type
Now I want to filter this table: I want to display only those Patients who have more then 2 Blood Collections and more then 2 Tissue Collections.
So, I want to see only Patient B, D, and E.
How can I do this?
There are a variety of ways you could accomplish your desired result. Probably one of the easier ways would be to unpivot your data such that 'blood collections' and 'tissue collections' are separate columns instead of one. I don't believe Tableau natively supports this while importing a data source currently; however, you can created two additional calculated fields to replicate an unpivot.
Blood Field:
IF [Collection_Type] = 'Blood'
THEN [Collection]
ELSE Null
END
Tissue Field:
IF [Collection_Type] = 'Tissue'
THEN [Collection]
ELSE Null
END
EDIT: Create a Calculated field that contains your desired condition for filtering, Ex.:
(SUM([Blood_field]) > 2 AND SUM([Tissue Field]) > 2)
Calculated field will evaluate to TRUE or FLASE. Filter for records for TRUE on this field

Adding different row values for Birt

I got this selection of data from my sql:
I would like to add Cancelled, Disputed and Resolved together and then divide the result with the total shipped. All of this should be done with an Expression.
So x / 303 where x is the sum of the desired values.
Goal would be to get a % where I can tell how good my shipping is.
I would then like to display the result in a text label next to a graph.
How do I do that?
You should use computed columns in your data set:
Add a SUM on the column Total and a filter only matching the rows based on the column Status you want to select. The expression should look like:
if (row["Status"] == "Cancelled" || row["Status"] == "Disputed"
|| row["Status"] == "Resolved")
true
else
false
create a second computed column only containing the "Total" value where the Status is Shipped.
if (row["Status"] == "Shipped")
row["Total"]
Then create a third computed column where you divide both computed values and you are done.
row["sum"] / row["shipped"]
create a new parameter and refer the image
create new static values and allow multiple values to be selected.
So, accordingly edit your SQL queries

How can I hide an rdlc report Tablix based on the contents of cells in a column, in Sql Server Report Services?

I have the following table in a report:
I need to hide the table (or even better, add some message that this has happened) for when all of the value cells pictured have no value. So in the picture example, the table would not be hidden, but if the 5 values were missing, it would be.
The problem is there's no real way to reference cells, or even columns in SSRS as far as I can tell via Google. Have I missed something?
My solution to this type of thing is to check the row count of the underlying data set for the tablix. If it is not zero, then show the tablix. This is what the expression would look something like in the Hidden property for the tablix.
=IIf(CountRows("DataSet1") <> 0, False, True)
Add a label that says something like "No data to report" to the report that only shows when the dataset is empty. Expression here:
=IIf(CountRows("DataSet1") = 0, False, True)
This assumes that no records will be returned in the dataset when there are no values for all selected columns. This also assumes that the name of your dataset is DataSet1.
EDIT:
Another possible approach is to check all of the dataset values that fill the cells, if they are all empty, then hide the tablix. Something like this could be used for the Hidden property:
=IIf(Fields!field_name1.Value <> "" OR Fields!field_name2.Value <> "" (etc.), False, True)
One other approach is to check for values in the SQL for the dataset. If all of the values are empty return an extra column, maybe named hidden, that is false. True if values are present. Not the prettiest approach, and it may mean a significant change to your SQL, but it could work.
With this last one, instead of returning true or false, you could return a 1 or 0. Then, in the RDL for the Hidden property, sum that column and if it is = 0, hide the tablix.
=IIf(Sum(Fields!hidden.Value, "DataSet1") <> 0, False, True)

How to create x-axis range groups with Crossfilter and dc.js?

Here is a fiddle to help show what I'd like to do:
http://jsfiddle.net/m4x7o5of/
I have a set of records, each with a float value. For example:
var records = [{name: 'record1', value: 1.34563}, ..., {name: 'record5000', value: 0.62974}];
I'd like to create a barchart in dc.js that plots the records on the x-axis in range buckets, e.g x-number of records with value between 0 and .5, y-number of records between .5 and 1, z-number of records between 1 and 1.5, and so on.
I'm using an ordinal scale so that I can divide the set of records into 5ths, but I can't figure out how to get the records grouped together in the ranges like I described. In the linked fiddle, only the records with a value that matches the plotted ordinals will get displayed right now.
Is it even possible to group the records like this? Any help would be appreciated.
dimension.group takes a function that you can use to derive the group key. So dimension.group(function(d) { return Math.floor(d); }); will give you group keys of 0, 1, 2, 3, 4, 5, 6, 7, and 8 for your data set. You'll just need to construct a function that returns the values you want based on the values in your data set. Is that what you're looking to do?

Resources