Qlikview: how to create summary table to filter multiple associated tables - qlikview

I have 4-5 tables of single and many rows per ID. I want to generate a summary table listing each ID along with various counts and max/mins, but I want to be able to filter on calculations. Example: "ID" is the identifier and there are two tables, TestA and TestB.
One desired selection criteria: Show only those IDs where at least one TestA score >5 and there is at least one TestB score.
In a straight table, this is simple to do with expressions, but the resulting table cannot be selected on the calculated true/false value.
I think I need to create a new table in the load script containing the ID, and then various conditions labeled as I wish. Then, these fields could be dimensions. This seems similar in concept to a master calendar. Am I on the right track?
If it helps to understand my example, this a medical application; the tables are lab results and other interventions that each require complex queries pulling data from various sources that are very "hard-coded" to produce a small data set from millions of rows of highly normalized source data. The desired dimensions would be combinations of the labs so as to allow identification of patients who meet certain criteria--then, once filtered, there would be many more graphs and charts to identify what tests and procedures were followed for that group of patients.
My current data model just loads many tables which then associate on ID. I had attempted to load all data into one big table using concatenates and calculations, but this did not seem to accomplish what I needed and was difficult to manage.

IIUC, I think what you want to do can be accomplished with a combination of sliders/input boxes, variables and calculated dimensions in your table. The process is definitely burdensome, but it should allow you filter the way you want.
Add a field to your table load statement in your script like rnum as RowNo().
Create a variable for your filter(s). Ex. vFilterTestAScore.
Add a slider or input box to your dashboard and point it to that variable.
a. For slider, the option is in the General tab -> Data header -> select the Variable radio button.
b. For input box, add the correct var from the list to the list of Displayed Variables.
Set sliders/input boxes to the criteria you want: vFilterTestAScore = 5 and vFilterTestBScore = 1
Create a straight table with ID as the dimension and expressions for TestAScore and TestBScore. The expression formulas would be sum(TestAScore) and sum(TestBScore) respectively (this won't make sense until the next step).
Now add a calculated dimension to you table. The idea here is that rather than just having the ID dimension, you will create a calculated dimension that only displays the ID of the records that meet the criteria you select in the slider or enter in the input box. The formula should be something like:
if(aggr(sum(TestA), rnum) >= vFilterTestAScore, ID, null()) or for multiple filters: if((aggr(sum(TestA), rnum) >= vFilterTestAScore) and (aggr(sum(TestB), rnum) >= vFilterTestBScore), ID, null()).
On your new calculated dimension, check the 'Suppress When Value is Null' box so only results that meet your criteria are displayed in your table.
To summarize, you are using the variables to store your selection criteria which you are entering via input box or slider. Then you are conditionally displaying only the ID's in your table that match those criteria via a calculated dimension and 'Suppress When Null' option.
I can send you a .qvw if you aren't using the free personal edition and are able to open other qvw's.

Related

Create list of display fields and checkbox fields from a table column in Oracle Apex

I am trying to create a list of display fields and checkbox fields from a table column in Oracle Apex. For example, let's say I have a Table A. These are the values stored in A.
ID Health Conditions
-- -----------------
1 Heart Disease
2 High Blood Pressure
3 Diabetes
So now I want to display these 3 display fields associated with 3 checkboxes so the users can choose whether they have the above health conditions problems. If Table A has n values, then I can dynamically display n fields with n checkboxes. How can I do this?
The way I understood the problem, you should pre-populate table (which will contain info about those health conditions) and display the whole list as Interactive Grid (or Tabular Form, depending on Apex version you use).
It means that you'd store non-checked values as well (though, you could delete such rows on submit).
Alternatively, if you create an "empty" Interactive Grid page and let users add rows, and for each row select health condition they have, you'd store only selected values.
Yet another option is to create a page with shuttle item (or select list that allows multiple selections) so that user would select only desired values and store them. Drowback of such an approach is that all values are stored into the same column (read: it is not normalized) separated by colons. That's OK for selecting values, but causes problems later when you have to do something with it as you have to first split values into rows and then do that something.

Comparing two datasets in SSRS

I'm looking to compare two datasets with each other. In an ideal world, I'd like to have it to show a green item if the data matches between the two. I have created two different GDocs files to get the code out there, to prevent SO from dinging me on formatting.
The first dataset is from our program itself, it pulls everything from our application, and displays the information, based on company code. The second dataset is from an external source requiring validation. The main fields I am matching are "NPI Number (Type 1)" from DS1 vs. "NPI" from DS2. If there is a match to highlight in green the row from both sides of data.
Dataset 1
Dataset 2
You may need to use LookUp function and set that as a expression to fill the background color of a text box or row of a table
Sample Expression: =iif(Len(Lookup(Fields!NPI.Value, Fields!NPI.Value, Fields!ProviderName.Value, "DS1"))>0,"Green","Red")
I have created a sample here. Download entire content and run it.

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.

SSRS Matrix Report : Colors condition

I have a matrix table created with Rows as Days ,Columns as Months and quantity of rainfall as the data field(got all this information from same table 'Rainfall'). I have taken this data from a dataset containing multiple tables in SQL. All of this information displays properly.
Now I have many tables with date field in my dataset in tables other than 'Rainfall'.
In the data field of the matix I need to be able to add my own colors using a Switch case.
The Condition I need is "if a certain date from one table matches the date in my report then i want xxx colour."
eg: there is a table called fertilization which has 3 dates. Now if these 3 dates also exists in my matrix then that block should be colored blue.
Can anyone help me. Thanks!
You can also manage it from sql side while retrieving data from Rainfall table.
You can do this using by right clicking the field that you want the dynamic color on and selecting properties. Select Border and then where it says color hit, click the Fx button. Here you can write a custom expression that will change the background color based upon your code.

how to display parent record and children from multiple tables

I have three tables, 1 parent with 2 child table 1-to-many relationships.
table 1: People
table 2: Phone numbers (any number of records)
table 3: email adresses (any number of records)
I would like a report looking like this:
Person1:
First_Name-------Last_Name
phone1:------12345----Home
phone2:------54321----work
mail1:-------first#mail.com----work
mail2:-------first#mail.com----work
mail3:-------first#mail.com----work
Person2:
-------First_Name-------Last_Name
phone1:------12345----Home
phone2:------54321----work
mail1:-------first#mail.com----work
mail2:-------first#mail.com----work
mail3:-------first#mail.com----work
I would very much like to do this using reporting services.
Edit: I know how to link all tables with left joins, I don't have a concept as how to get this done.
OK, here's a sort of summary of how you need to approach it. I can't give you a step-by-step because it would be impossibly long, but this should get you started. (Also note that I'm doing this from memory):
You will need three datasets, one each for people, phone numbers, and email addresses. I am going to assume that the phone numbers and email addresses have some kind of ID field in common, some way to tie people to phones and to email addresses. You will need that field in your datasets.
You don't need to do any joins in your SQL: the linking between the three datasets will be done within the report.
Put a Matrix on your report. Have it draw from the People dataset. Put the first and last name in the detail row of the Matrix.
Add a new detail row to your Matrix, under your first and last name.
Merge the cells in your new detail row so that you have one very wide cell.
Embed (drag and drop) a new Matrix in the single wide cell in your new detail row.
Link your matrix to the Phones dataset. Set up a record filter in the matrix to limit the records to those that match the ID field in the parent matrix.
Set up the Phones as you want in the embedded child Matrix.
Repeat steps 3-7 with the Email Addresses dataset.
You don't actually need to do any grouping (unless you want to include subtotals of some kind), because you're not actually grouping anything: you're just displaying a list with embedded sub-lists.