"Does Not Exist" (DNE) property filter for Keen IO analysis calls - data-analysis

I'm trying to write a query against my Keen IO collection of pageviews, I really need a particular property to be filtered out. That is a filter for whenever a referral_URL "does not exist" (DNE).
I noticed there is a full list of other filter operations, but no DNE. I tried "Equal to" "Null" but it didn't do it for me.
List of Filter Operations: https://keen.io/docs/api/#operator-definitions
Is this possible?

Use the "Property Exists" operator. You will find it about half-way down the list of operators in your screenshot.
However, once you select that operator, you will see the value on the right default to "True". This would actually be the opposite of what you're after. To get DNE, you need to set the boolean value to "False".
You're correct in your findings that the "Equal to" "Null" doesn't work in the same way as DNE. Behaviorally, that is a string comparison, so events that do not have a value will not satisfy that filter.

Related

Conditional Split Explained

Trying to understand what the following conditional split expression is trying to do:
ISNULL(Employee_ID_WD) || (RIGHT(REPLACENULL(Employee_ID_WD,"0"),LEN(REPLACENULL(Employee_ID,"0"))) != REPLACENULL(Employee_ID,"0"))
I am new to SSIS, can anyone explain this?
It’s a relatively straight forward expression when you break it down.
To put it succinctly (tl;dr), if the Employee_ID_WD is null OR the Employee_ID value is not in the Employee_ID_WD value, then return true. Otherwise, return false.
Details:
The first part, ISNULL(Employee_ID_WD), checks to see of the Employee_ID_WD is null. If it is, the expression will return true, right away. The reason for that is the || right after. This is called a logical or. If you see this in many programming it indicates that the programmer wants to the expression to return right away if any part of it before the || is true. In other words, if something before the || is true, start doing what I need you to do, there is no sense in checking anything in this expression, I know what I need to know in order to move on. This is referred to as short-circuit evaluation. Wiki.
If the Employee_ID_WD is not null, we move on to the next part of the expression.
This part:
(RIGHT(REPLACENULL(Employee_ID_WD,"0"),LEN(REPLACENULL(Employee_ID,"0")))
is grabbing the characters on the right side of the Employee_ID_WD. The number of characters it is asking for is what is returned from the LEN (length) function being run on the Employee_ID. Also, both parts of this are checking if the value they pass in is null, as indicated by the REPLACENULL function. If they are null, a string with the value 0 is returned. This is done in case one of the values are null, this way you get a true value comparison. Using the REPLACENULL function in all parts of this expression makes it that much more robust, meaning inconsistencies with data will be handled without something error-ing out, or giving in consistent results in the end.
The results from the part above are compared to REPLACENULL(Employee_ID,"0"). If the part above and this are not equal (!= is not equal to), then the expression returns true.
SSIS Expression Reference

SSRS Count or Sum expression

I cannot work out why these Total expressions don't work...
I am trying to add any cells that have a date later than today, with any cells that have "Not Reqd", and then divide that by the number of rows, to get a percentage.
All I'm getting is #Error.
These are the expressions I've tried:
=SUM(IIf(Fields!Jetter_Trng.Value >Today OR
Fields!Jetter_Trng.Value = "Not Reqd",1,0)))/(Count(Fields!Jetter_Trng.Value)
and
=Count(IIf(Fields!Jetter_Trng.Value >Today OR
Fields!Jetter_Trng.Value = "Not Reqd",1,Nothing)))/(Count(Fields!Jetter_Trng.Value)
The "Not Reqd" string has come from an expression that changes a date (01/01/1950) to "Not Reqd". Maybe this is messing things up:
=iif(Fields!Jetter_Trng.Value = "01/01/1950", "Not Reqd", Fields!Jetter_Trng.Value)
The current working expression (not looking for "Not Reqd") is:
=COUNT(IIF(Fields!Jetter_Trng.Value>Today,1,Nothing)))/(Count(Fields!Name.Value))
I'm a bit lost...
A couple of notes on your expression as it stands at present
Jetter_Trng appears to be a string representing either a date or “Not Reqd”. You can’t compare strings to dates without casting them to a date type first using CDATE()
The number of braces (( and )) do not match
The root of your problem though is that you are using Jetter_Trng to return either a Date, or the value “Not Reqd”.
When SSRS attempts to evaluate an expression it does it all at the same time. It doesn’t follow a path to find the answer, and ignore other paths. Therefore, when you are attempting to compare
Fields!Jetter_Trng.Value >Today
This is comparing a string to a date, and throwing the error, as this mean nothing
"Not Reqd" > Today
You won’t be able to do all that you want to using only one Field of type string.
Your options are to
Use two fields – the date and a flag indicating not required, or
Use one field – but have an “invalid date” (01/01/2100 perhaps) that you could then treat as the “Not Reqd” value, and check if the current date is less than that (which it always will be)
Using the second option here you could then use the following expression to create the desired calculation
=sum(iif(CDate(Fields!Jetter_Trng.Value) > Today, 1, 0)) /
Count(Fields!Jetter_Trng.Value)
Which would evaluate this dataset as follows

SSRS Ignore Filters Based on a specific Filter used

Good day
I have a SSRS report that has 4 filters.
One of the 4 filters is a "Search Parameter".
When the user uses the "Search Parameter" (field/filter, types something in), I want to ignore the other three filters despite them having values or not.
I've tried CASE/SWITCH statements in the Expression of the Parameter (DataSet Properties), but no luck.
Does anyone have an idea on how I can get this done
The Filter is quick and convenient but only allows AND relationships between the filter criteria and you want an OR relationship here.
The good news is that you can make more complex filter logic by using expressions. We will create a boolean filter expression that evaluates to whether you want to filter the row or not and compare this to True.
Have only one filter criterion and click the expression editor button. Make the expression something like:
=IIF(IsNothing(Parameters!SearchParameter.Value), Fields!Field1.Value = Parameters!Field1Parameter AND Fields!Field2.Value = Parameters!Field2Parameter AND Fields!Field3.Value = Parameters!Field3Parameter, Fields!SearchField.Value LIKE "*" & Parameters!SearchParameter.Value & "*")
Make the expression type be Boolean, the Operator = and the Value True.

Adding optional filter in SSRS

I have a multi valued parameter in my ssrs report. (Bus numbers) the question is how can I make the data set filter property optional? i've seen a blog that makes the filtering optional but my question is how can i do that if my parameter is multi valued?
http://www.andrewshough.com/development/sqlserver/ssrs/optional-filter-in-ssrs/
I tried adding a "No Filter" in my selection list but i cant seem to make it work.
=IIF(Parameters!BusNumber.Value = "No Filter", "",Fields!BusNumber.Value)
Typically, if you have a multi-valued parameter, there's an implicit way to "not filter": select all options.
As a user, if I get to choose a "filter" parameter #OnlyTheseCategoryIds, and I check the Select all option, I'd expect my results to come through "unfiltered" (even though technically it is filtered, just every row passes that filter).
You've already mentioned one more explicit alternative ("No Filter" option), but "cant seem to make it work" is hardly enough info for us to be able to help you (other than completely spelling out how to do it).
Another alternative would be to create a cascading parameter before the filter-one, something like #FilterOnCategories (boolean). Only if "True" is selected will the second parameter be available.

Adding optional filter in SSRS 2008

I am trying to add an optional filter on a text field in a report. I have tried setting it up in the dataset but it treats it as a required filter so if it is not populated, no results are returned. It needs to use the Like operator. Any advice?
As I was typing out a work-around to this problem, I realized an incredibly easy solution (now that I understand better how it works).
Here's what I did:
Since Hong pointed out that all filter conditions must be met, I reversed my thinking. I moved my existing "IN" filters to the query and fed the parameter directly to the query. Then I created by "LIKE" text filter on the report which a default value of "*" so it would immediately return everything.
Here's what I could've done:
Just the last part. Added the "LIKE" filter with a default value of "*" so it immediately returned everything.
I also agree that most of the time it's best to send the params back to SQL. Since that's not what the OP is asking, here is the best option I have found for doing this. And it is actually quite simple.
Add your parameter with the appropriate data type. Let's use the
example of a "City" in this case (a text/string field).
Check "Allow Nulls" on the parameter.
Add a filter to either a tablix, table or dataset.
In the expression, select the field you want to filter on. Select the appropriate operator, in my example of a data set with Cities, in the Value put in this:
=IIF((Parameters!City.Value Is Nothing), Fields!City.Value, Parameters!City.Value)
I don't think you can make an optional filter in DataSet Properties/Filters, adding filters there means returning results that match ALL filter contiditions, so it is "AND" logical relation among all filters, not "OR".
My sugguestion is to use filter in query designer of the dataset, where you can define "OR" relations to filter out data. For instance: Your_Text_Field="SomeValue" OR Your_Text_Field is Empty.
Although I agree that most of the time it is best to send the parameters back to the stored procedure or data layer to reduce the amount of data returned, I have a case where it is just as easy to do the parameter handling in the RDL file via a filter. Due to this unique situation I found this solution which gives you a way to create an Optional filter in the RDL file.
http://www.andrewshough.com/development/sqlserver/ssrs/optional-filter-in-ssrs/
It is a great blog post with easy step by step instructions on how to create an optional filter.
Please Note: This is NOT my blog but I though this solution was great for what I needed and I hope it helps someone else when they google for "optional filter in SSRS" like I did.
I found a post which solved my problem setting the filter for a report-consumer to a) all multivalue fields being selected so the user b) could specify his/her selection if necessary.
Kasim 8 Dec 2010 8:55 AM #
In reports when we want to default the multivalue parameter to 'Select All' following are the steps.
Open the Report parameter window from the Report menu.
Select the Report parameter from the left handside of the window.
Select 'Multi-value' checkbox and appropriate 'Available values'.
Under default values select 'From Query' radio button'.
Select the appropriate 'Dataset'.
Select appropriate 'Value Field'.
Save the Report and select Preview Tab. You will find all the items selected in the multivalue >parameter list and the result displayed for all the selected items.
found on: http://blogs.msdn.com/b/bimusings/archive/2007/05/07/how-do-you-set-select-all-as-the-default-for-multi-value-parameters-in-reporting-services.aspx
(The Post came up in the comments quite in the middle.)
You can accomplish this by using an expression on the dataset filter.
Check this