SSRS - filtering out records - ssrs-tablix

From the Tablix Properties > Change Filters screen, I can add and delete filters.
The Field that I'm working with is called MBA_Account.
If I set it to Expression: MBA_Account; Operator =; value: Administrative; it works. I get just 1 line in the output called Administrative, and the aggregated data that correlates with that account.
There are 30 records in the database, I'm only interested in including 10 in my report.
To bring in the other 9 accounts to the report, should I add more filters or should I use an AND operator set in just 1 filter in order to effectively isolate just the Account codes I want included in the output?
In other words:
Option A)
Expression: MBA_Account
Operator: =
Value: and(Administrative, Salaries, Repairs)
Option B)
Expression: MBA_Account
Operator: =
Value: Administrative
; and then repeat the filter but change the value per line (this option doesn't seem to be working)

Change your dataset query to include a WHERE clause like this:
Where MBA_Account IN ('Administrative','Salaries','Repairs')
By doing this you only return the records you're interested in seeing and your report does not have to do any filtering (at the Tablix level).

Related

Google Sheet Query: Select misses data when there are different data type in a column?

I have a table like this:
a
b
c
1
2
abc
2
3
4.00
note c2 is text while c3 is a number.
When I do
=QUERY(A1:C,"select *")
The result is like
a
b
c
1
2
2
3
4.00
The "text" in C2 has been missed. You can see the live sheet here:
https://docs.google.com/spreadsheets/d/1UOiP1JILUwgyYUsmy5RzQrpGj7opvPEXE46B3xfvHoQ/edit?usp=sharing
How to deal with this issue?
QUERY is very useful, but it has a main limitation: only can handle one kind of data per column. The other data is left as blank. There are usually ways to try to overcome this from inside the QUERY, but I've found them unfruitful. What you can do is just to use:
={A:C}
You can work with filters by its own, but as a step-by-step to adapt the main features of query: If you need to add conditions, use LAMBDA INDEX and FILTER
For example, to check where A is not null:
=LAMBDA(quer,FILTER(quer,INDEX(quer,,1)<>""))({A:C}) --> with INDEX(quer,,1), I've accesed the first column
Where B is more than one cell and less than other:
=LAMBDA(quer,FILTER(quer,INDEX(quer,,2)>D1,INDEX(quer,,2)<D2))({A:C})
For sorting and limiting an amount of items, use SORTN. For example, you want to sort by 3rd column and limit to 5 higher values in that column:
=LAMBDA(quer,SORTN(FILTER(quer,INDEX(quer,,1)<>""),5,1,3,0))({A:C})
Or, to limit to 5 elements without sorting use ARRAY_CONSTRAIN:
=ARRAY_CONSTRAIN(LAMBDA(quer,FILTER(quer,INDEX(quer,,1)<>""))({A:C}),5)
There are other options, you can use REGEXMATCH and other options, and emulate QUERYs functions without missing data. Let me know!
shenkwen,
If you are comfortable with adding an Google App Script in your sheet to give you a custom function, I have a QUERY replacement function that supports all standard SQL SELECT syntax. I don't analyze the column data to try and force to one type based on which is the most common data in the column - so this is not an issue.
The custom function code - is one file and is at:
https://github.com/demmings/gsSQL/tree/main/dist
After you save, you have a new function from your sheet. In your example, the syntax would be
=gsSQL("select a,b,c from testTable", {{"testTable", "F150:H152", 60, true}})
If your data is on a separate tab called 'testTable'(or whatever you want), the second parameter is not required.
I have typed in your example data into my test sheet (see line 150)
https://docs.google.com/spreadsheets/d/1Zmyk7a7u0xvICrxen-c0CdpssrLTkHwYx6XL00Tb1ws/edit?usp=sharing

Distinct values for SSRS Parameter when query returns Duplicates

I have a parameter that receives his values from a dataset, but I receive multiple instance of the same value and I need to filter those in order to have only 1 occurence per value. I cant seem to find where I can manually edit the query.
This is what I get when I select Report Parameter Properties / Available Values / Get values from a query.
How can I filter it so I only get 1 of each which would make it easier for the user when I what to select what he wants to see from the report.
Thank you

Column to ignore dashboard prompt

I have a report with 2 columns, both columns measure Sales. I would like 1 column to filter on a supplier while the second column would be overall sales so that I can compare the sales of the supplier to the total sales. This report would be used on a dashboard, however I cannot figure out how to get the total sales column to ignore the prompt for the supplier. Is there any clauses I can use to ignore the dashboard prompt for this one column?
Method:
The prompt sets the variable
Report A calls on the variable to tell it what to include
Report B calls on the variable to tell it what to exclude
How-to
Setup Prompt for “INCLUDE” variable.
Notice the "Set a variable" is set to Presentation Variable:
Report A
Report Filter: Setup Report Variable to accept “Include”:
Report B
**Save a copy of the report and say “is not equal to”
To compare the “All Other except for” report
Below is a simple example on a dashboard.
With no filter set, notice that the "exclude" side is showing all results:
A user must then select an item from the prompt (setting the "Include" variable)
Once the user presses apply you notice that the left side is including the selections and the right side is including everything EXCEPT for whats on the left side:

How do I specify columns to include in a matrix

I have a matrix that has a group filtered at the matrix level. I can't filter the SQL because it is very large and is used all over my report.
I need to be able to specify the columns to display after the filter is applied.
The end filter would look something like this
if ColumnA[value] IN Test1,Test2,Test3 OR ColumnB[name]
As you can see I want a value string filter and make sure ColumnB get displayed at all times.
Or being able to specify the columns to show in the matrix would work also.
You can filter at the dataset level: see here for more detail.
To filter a tablix, go into Tablix Properties and open up the Filters tab. You can write a Boolean expression (must evaluate to TRUE for the record to come into the Tablix) to do the filtering there.
I ended up using a tablix and creating columns for each column I wanted to display and rows for each row item. I then used a Count(IIF()) statement to match the specific item I needed to calculate for that cell. I wanted to use the matrix so it would not be so long winded but in the end I got the job done. I have since used this method on many occasions.

ReportViewer - how to filter on Multi Value Parameter

I have a report that uses a Multi Value parameter. I have added this to the report and can specify the parameter values in code.
Now I want to filter the data on the report by the multiple value parameter. Eg, I pass in a list of account no's and I want to filter the data on the report so only records with the passed in account no's are shown.
In the tablix properties there is a filters option which looks like the place I need to set up the filters.
I have added a new one, selected the Account Number column on the report. The operator that seems relevant to me is the 'in' operator. So show records that a 'in' this list. However, If i select the 'in' filter the expression text box is disabled. Is this what im meant to use?
Found it:
You should filter on The name of the parameter rather than an expression.
eg:
[#CostCentres]
rather than:
=Parameters!CostCentres.Value

Resources