Filtering by custom dimension - universal-analytics

I created a hit scoped custom dimension called "type". Also I created a view with include filter "type" = "Books". However in reports I see click hits with other dimension values (e.g., Books Sci-Fi). Do I have to add also exclude filter for view?

Essentially problem was that filter value have to be reg. exp. I changed it to ^Books$ and now hits with custom dimension "Books Sci-Fi" are excluded.

Related

Filemaker conditional dropdown population

continuing a project I have posted a few questions for already are you able to have a more precise definition of what a dropdown is populated with?
I am using FM Starting Point and have a Projects, Estimate and Task table. A project can hold multiple estimates and tasks. Estimates contain multiple lines (stored in a separate table).
When In a Project you can add a task for that project. What I want to do is replace the field that gives the task a name with a list of lines contained within the estimates related to the project i have selected to add the task from.
I have created a dropdown and using the inspector got it to display all estimate lines but somehow I need to write a function that will only select lines from estimates that are within the project and also only estimates that have a field set to "active" for example.
what I am struggling with is where I can programme such a thing? In the inspector, you are limited to displaying a value and cant programme in a statement. I have tried a script that executes OnObjectEnter or OnObjectModify but that doesn't appear to work.
Any ideas where I can enter a more complex set of rules as to what populates a dropdown?
Create a relationship with the criteria you need. Base the value list for the dropdown on this relationship.
As for display, The value list's second field can be from a calculated field with any data or several other fields stringed together if no single field is sufficient. The first field should be the ID.

how to create multiple filters from one dimension tableau (10)?

I have a two dimensions with the following data set
Original Dimension
I would like to create two filters that can be used to filter my dashboard. These two filter would be called - "Product_Type" and "Product" and should have the following drop downs:
Filter Breakdown
To summarize, I am looking for a way to take my original dimension and create the filter breakdowns so that in my dashboard I can have two filter (Product_type and Product). When i click on the Product_type filter, i should be able to see "overall", "fruits", "vegetable" and "leafy. Based on my selection , the Product filter should automatically show only the relevant values - i.e. if i picked "leafy" it should only show "spinach" and "kale". Finally if i select "kale" my entire dashboard should change accordingly.
Looking for a way to do this without drastically affecting the performance.
update: i was able to achieve this by creating multiple parameters and then using the pop window technique (https://vimeo.com/107352893) - but this has affected my workbook performance very badly. Need another solution!!
You should be able to accomplish your desired functionality by creating a calculated field for product type and a CASE statement to classify the products based on the product type you specified your image.
Further, filters can be configured to display available values based on the other filters in place. I would recommend having your Product Type filter a the "context" or "data-source" level, and your product filter at the lowest level, so that the selectable options for the product filter can be displayed using the "only relevant Values" option and limits the products that can be chosen.
Please see the following link for some more information on filtering hierarchies
Performance Related
General Filtering
Blog Post
"Only relevant values - Specifies which values to show in the filter. When you select this option other filters are considered and only values that pass these filters are shown. For example, a filter on State will only show the Eastern states when a filter on Region is set. You can use the toggle at the top of the filter card to switch between this option and the All Values in Database option.
All values in database - Specifies which values to show in the filter. When you select this option all values in the database are shown regardless of the other filters on the view.
All values in context (Tableau Desktop only) - When one of the filters in the view is a context filter, select this option on a different filter to only display values that pass through the context filter. For more information, see Improve View Performance with Context Filters."

Tableau parameter filter with multiple values?

In Tableau 9.2, I currently have a parameter set up which contains multiple string values and an additional "All" value. I also have a calculated field which only contains the Str([some_field]) function. I have then dragged this calculated field into the "filters" pane and from there enabled "use all" and put the following formula under the "condition" tab:
// If All is selected, then do not filter
[my_filter_parameter] = 'All' OR
// Otherwise, filter on the current parameter
[my_filter_parameter] = [my_calculated_Field]
After creating the calculated field for multiple sheets in my dashboard (which use different data sources all contain the common some_field), then I can change the parameter's value and it will filter all of the sheets at once.
My issue is that I need this to take on multiple values at once via a check-box. I understand that a parameter can only take on one value at a time, so I am wondering how I can do this without making the same filter for each individual sheet in the dashboard. Perhaps this can be done with a calculated field?
EDIT: I have tried the technique here to make a global filter via a control view. This allows me to use Ctrl+Clicking to select multiple values in some_field at once, however I still do not have a dropdown box. Alternatively, if anyone knows how to use this method with a dropdown box, then that would be another solution.
If I am understanding your situation correctly, I have accomplished this using the following:
Create a calculated field and put the following code:
if [parameters].parametername = 'All' then true
elseif [parameters].parametername = FILTEREDCOLUMN then true
else false
end
Add that calculated field to the filters pane and select "True" - in other words, filter out any records where the calculated field is False. If the parameter you selected is "All" then all records will be True. Otherwise, it will only be True if the parameter matches the FILTEREDCOLUMN. I hope that helps.
Parameter can pass only one value at a time ,i.e. Parameter Control will have Single Drop Down List.

SSRS Multiple Dataset Errors

I have a simple SSRS report that displays data from one table. What I want to do is have a distinct list from that table displayed in a drop down list for the user to select. If I only use one dataset I can get it to display, but it displays values from the column multiple times.
Example
Bob
Bob
Bob
Cathy
Cathy
If I create a second dataset that will list distinct values I get the following error message:
An Error occurred during local report processing. The definition of the report is invalid. The Variable expression for the report 'body' refers directly to the field without specifying a dataset aggregate. When the report contains multiple datasets, field references outside of a data region must be contained within aggregate functions which specify a dataset scope.
I"m trying to follow the example I found here:
http://msdn.microsoft.com/en-us/library/aa337400.aspx
The second dataset is only for the parameter list. I don't understand why it's causing problems with the actual report.
It's impossible to tell exactly where without the report definition, but there is an item on the report that is referencing a field or Dataset, and was implicitly using the only Dataset present in the report, but now doesn't know which Dataset to use once more than one is added to the report.
For example, when you create a table you can set a Dataset associated with it. If this is not set and there is only one Dataset, it doesn't matter as it will take the only one available. Once you add a new Dataset, the table doesn't know which one to use and you'll get the error you're seeing.
Another way to get the error is specifying a field in an expression, e.g. in a TextBox in the report somewhere without specifying the scope; just set the scope to a particular Dataset e.g. if you have:
=Count(Fields!name.Value)
change this to:
=Count(Fields!name.Value, "DatasetToUse")
If you've only got one Dataset the first expression will run fine by using the only one available, but once you add another it won't know which to use and it will error.
in the query (SQL) you should add DISTINCT clause at the beginning, that way, you will get only one record per value. Check out http://www.w3schools.com/sql/sql_distinct.asp
Double click the Dataset which contains that field.
Go to fields on the left and delete that field.
Add new field by clicking Add -> Query Field.
Just type in the name of the new field under field name and field source.
It happens when you have added a field by selecting "Calculated Field" instead of "Query Field" from Dataset Fields list tab.
Cheers,
Ahmed Latif

Create a new FileMaker layout showing unique records based on one field and a count for each

I have a table like this:
Application,Program,UsedObject
It can have data like this:
A,P1,ZZ
A,P1,BB
A,P2,CC
B,F1,KK
I'd like to create a layout to show:
Application,# of Programs
A,2
B,1
The point is to count the distinct programs.
For the life of me I can't make this work in FileMaker. I've created a summary field to count programs resetting after each group, but because it doesn't eliminate the duplicate programs I get:
A,3
B,1
Any help much appreciated.
Create a a summary field as:
cntApplicaiton = Count of Application
Do this by going into define fields, create a field called cntApplication, type summary. In the options dialogue make the summary field a count on application
Now create a new layout with a subsummary part and nobody. The subsummary should be sorted on Application. Put the Application and cntApplication fields in subsummary. If you enter browse mode and sort by Application you ought to get the data you want.
You can also create a calc field with the formula
GetSummary(cntApplication; Application)
This will allow you to use the total number of Applications with in a record
Since I also generate the data in this form, the solution I've adopted is to fill two tables in FileMaker. One provides the summary view, the other the detailed view.
I think that your problem is down to dupliate records and an inadequate key.
Create a text field called "App_Prog". In the options box set it to an auto-enter calc, unchecking the 'Do not replace...' option, and use the following calc:
Application & "_" & Program
Now create a self join to the table using App_Prog as the field on both sides, and call this 'MatchingApps'.
Now, create (if you don't alread have one) a unique serial number field, 'Counter' say, and make sure that you enter a value in each record. (Find all, click in the field, and use serial number option in'Replace Field Contents...')
Now add a new calc field - Is_Duplicate with the following calc...
If (Counter = MatchingApps::Counter; "Master Record" ; "Duplicate")
Finally, find all, click in the 'Application field, and use 'Replace Field Contents...' with a calculation to force the auto-enter calc for 'App_Prog' to come up with a value.
Where does this get you? You should now have a set of records that are marker either "Master Record" or "Duplicate". Do a find on "Master Record", and then you can perform your summary (by Application) to do a count of distinct application-program pairs.
If you have access to custom functions (you need FileMaker Pro Advanced), I'd do it like this:
Add the RemoveDuplicates function as found here (this is a recursive function that takes a list of strings and returns a list of unique values).
In the relationships graph, add another occurrence of your table and add an Application = Application relationship.
Create a calculated field in the table with the calculation looking something like this:
ValueCount(RemoveDuplicates(List(TABLE2::Program)))
You'll find that each record will contain the number of distinct programs for the given application. Showing a summary for each application should be relatively trivial from here.
I think the best way to do this is to create a separate applications table. So as you've given the data, it would have two records, one for A and one for B.
So, with the addition of an Applications table and your existing table, which I'll call Objects, create a relationship from Applications to Objects (with a table occurrence called ObjectsParent) based on the ApplicationName as the match field. Create a self join relationship between Objects and itself with both Application and Program as the match fields. I'll call one of the "table occurrences" ObjectsParent and the other ObjectsChildren. Make sure that there's a primary key field in Objects that is set to auto-enter a serial number or some other method to ensure uniqueness. I'll call this ID.
So your relationship graph has three table occurrences:
Applications::Applicaiton = ObjectsParent::Application
ObjectsParent::Application = ObjectsChildren::Application, ObjectsParent::Program = ObjectsChildren::Program
Now create a calculation field in Objects, and calculating from the context of ObjectsParent, give it the following formula:
AppCount = Count( ObjectsChildren::ID )
Create a calculation field in Applications and calculating from the context of the table occurrence you used to relate it to ObjectsParent with the following formula:
AppCount = ObjectsParent::AppCount
The count field in Objects will have the same value for every object with the same application, so it doesn't matter which one you get this data from.
If you now view the data in Applications in list view, you can place the Applications::Application and Applications::AppCount fields on the layout and you should get what you've requested.