I'm creating a new report where one of my flags as to do with the Taxes we have here in Quebec. In this report, I'm displaying invoices with a header, the details (items) and then the total with the taxes.
Now here in Quebec we have TPS and TVQ as taxes. Sometimes, when we sell outside of the Quebec area at one of our other branch, we wont have the TVQ.
The goal of my flag, is to turn the textbox red when TPS is there and TVQ isn't there. I also want to do the same thing if TVQ is there and TPS isn't.
I kinda feel like it should look a little like that
IIF ((Fields!TAXDLID.Value = "TPS") AND (Fields!TAXDLID.Value = "TVQ"), black, red)
but I can't wrap my head around.
Thanks for the help!
edit:
Here is something that works and doesn't need red flags
Here is something that also works and doesn't need red flags
Here is something that does not work and would need a flags since it doesn't have TVQ
It's also possible to have nothing in the section
It's not perfectly clear what your dataset looks like (from your dataset query) so I have made some assumptions as follows:
Each row in your dataset has a Column that is either 'TPS' or 'TVQ'
Your dataset only contains data for a single invoice per report.
Your main report dataset is called dsMain
Assuming 1 invoice per report
Assuming the above, as your column can only contain one of two values we can simple count how many unique values are in the dataset.
You can do something like this
=IIF(CountDistinct(Fields!TAXDLID.Value,"dsMain") >1, "Black", "Red")
More than one invoice per report
If you are producing more than one invoice per report then I would imagine you have a row group setup that groups by invoice number. If this row group is called grpInvoice then you need to swap out the dsMain scope expression for the name of your row gorup
e.g.
=IIF(CountDistinct(Fields!TAXDLID.Value,"grpInvoice") >1, "Black", "Red")
Note
The scope name MUST be the exact spelling of the row group name or dataset name, it is case sensitive AND is must be enclosed in quotes as per the example.
If this does not help, please provide a sample of the data that comes from your dataset query and your report design including grouping info where applicable.
Related
I am just starting out in SSRS and have a dataset that looks like the below.
I have built this in a matrix table like so
I want to show what percentage each of the rows total is of the grand total, so for the attached image I would want to show what percentage 35 (counselling calls) is of 47 (total) and what percentage Legal calls (12) is of total (47)
I have tried =Fields!Calls.Value/sum(Fields!Calls.Value) but that just gives me 100% for both?
Would appreciate any help
You need to specify the scope of your SUM() expressions.
I'll briefly explain how scopes work and then get to the answer.
SSRS always evaluates an expression based on it's scope which is usually defined by the physical location of the expression within table/matrix. As you can see from your design all 4 textboxes show the same expression, [SUM(Calls}] which in fact is actually =SUM(Fields!Calls.Value). However they give different results because the scope of each is different. The first is in the category rowgroup and the month column group for example, the second one is in the category row group but in the total month group, and so on...
OK, now to the answer !
Assumming
your rowgroup is called 'CategoryGroup` (you will see the name in the rowgroup panel under the main designer)
your dataset is called DataSet1
You expression should be
=SUM(Fields!Calls.Value, "CategoryGroup") / SUM(Fields!Calls.Value, "DataSet1")
This basically reads..
Take the sum of the call column for all rows that are within the current CategoryRowgroup and divide by the sum of the call column across the whole dataset.
Notes
The scope names must be enclosed in quote and are case sensitive
The scope names must match either a row or column group, or a dataset name exactly.
the , "CategoryGroup" scope argument can probably be omitted as this should be the scope of the textbox anyway.
Hello awesome people of stackoverflow!
I need help with a simple problem with my SSRS expression.
How could I do this in SSRS?
As you can on the 2nd table below in my excel screenshot.
for each row we divide -BC5...-BC10 to column/row BC4. To get the desired results for table 2 in excel column total 2018 into column/rows BC17 upto BC22.
I've tried referencing my textbox like this
ReportItems!TextBox1.Value / ReportItems!TextBox2.Value.
But got me the wrong values.
Can someone please help.
Thank you!
If those two tables are in the same table/tablix then it should work with the expression that you wrote (try to type it instead of copy paste sometimes that may work).
=(ReportItems!Textbox7.Value /ReportItems!Textbox1.Value) * 100
If they are not in the same Table/Tablix then you should write like the following:
=(Fields!ColumnName1.Value / Fields!ColumnName2.Value) * 100
Format your cells.
There is not enough info to give you an exact answer but you should be able to work it out.
The first thing you need to do is get the context of the aggregations you want to work with. So click on the cell containing the number you want to divide ([Sum(DiscountOERestated)] ). In the row and column groups panel near the bottom on the screen, look at the row group that is highlighted. For this example I'll assume the row group is called grpCategory.
Now we need to do the same for GrossCatalogRestated. However, GrossCatalogRestated in the top tablix does not appear to be an aggregate. I'll assume it should be the total GrossCatalogRestated for the dataset. For this exmaple, we'll say the dataset name is dsMyDataSet. If it's within a row group, just swap the dataset name out with the row group name that it sits in, just like we did for DiscountOERestated .
So you expression would look something like
=SUM(Fields!DiscountOERestated.Value, "grpCategory") / SUM(Fields!GrossCatalogRestated .Value, "myDataSetName")
This will give you a deicmal result, somehting like 0.025 . You then just need to set the format property to say, "p1", so it shows as 2.5%
If this does not work, edit your question to show the expressions in the cells you are working with along with the rowgroup and dataset names.
I have a report showing hours and dollars that are written off. Jobs for this report are classified as NRB (non-billable) and non-NRB (billable). Each job type has its own Tablix in the report and I want to populate each Tablix based on a bit value - IsNRB.
All of the "0" IsNRB rows should populate the top Tablix and the "1" values should populate the bottom Tablix . For the most part this is working. What is happening, however, is that some Programs or Clients will have both NRB and non-NRB jobs, and it appears that as each Tablix works its way through the rows of the report dataset, it will capture and retain the first value for IsNRB and apply that to the entire report.
I have tried logic similar to the following in a number of places/ways:
=IIF(Fields!IsNRB.Value = False, Fields!CustProgram.Value, NOTHING)
The Grouping hierarchy of the report looks like this:
ProgramGroup
ClientGroup
Job/SubJobGroup
Detail is here
I have tried setting evaluative expressions similar to the one above on TablixVisibility, GroupVisibility, RowVisibility, and in the field expression itself. The behavior seems consistent in that the first row for that Program, Client, or Job sets the value of IsNRB for the entire report.
As a concrete example, the first Program, "Cascadia" has three rows where IsNRB = 1/True and two where IsNRB = 0/False, and the latter two rows of data are always misapplied because the value of 1/True is overriding the 0/False valued rows.
What is the proper approach to take that will allow the first Tablix to accept and display rows of data where IsNRB = 0 and the second Tablix to show those with a value of 1? Do I need to abandon the IsNRB bit datatype and just have a distinct dataset for each Tablix? That seems like a klunky way to approach the report.
Filter each table on the IsNRB field. Right click the tablix and select Tablix Properties. Select filter, then then select the field you want to filter against (IsNRB) and the value your want it to be (1).
This will put all records with a 1 for the field in one table, and with a 0 in the other
I've a custom Invoice that I'm building and it's divided up into four sections. I have built the data set so that it has the following data:
Code, Earnings, Rate, Cost, Total, Section
My stored procedure attaches a section based on criteria in within.
I placed a table on the report and added the first 4 data elements and then put a row visibility constraint on it based on section <> 1. Then I added three more tables to the report, each instead having the row visibility constraint <> 2,3,4.
All this displays properly.
Now in each table, i want to subtotal only the rows that are visible based on the filter. But when I try to do a sum, I get the "grand total" of all rows(unfiltered).
In the sample picture below you can see the 4 sections and the red circles show where =SUM(Fields!Total.Value) display the "grand total". The values should be:
17,887.55
0
32.48
22.86
Ideas?
Thanks,
PS It won't let me display the image of my report, so i have it here on my Microsoft Exchange OneDrive: http://1drv.ms/1HPXdgO
It seems like you have a row group on “wc code/Description”. You just need to pass scope (name of the row group) in your sum method. So your method will look like:
=SUM(Fields!Total.Value,””)
Here is what I did to solve the problem though it's a work around rather than actually doing what I wanted SSRS to do.
I added four more records to my stored procedure each one grouping by section and forcing a section 101, 102, 103, and 104 to correspond to sections 1, 2, 3, and 4. Then a fifth record is added to correspond to the grand total record and section 1000 is used to denote this.
Then I added 4 more tables(each having only one row) to the report each filtering on 101, 102, 103, and 104 respectively and the grand total table filtering on 1000.
This makes the report function as per my requirements. If anyone knows how to do it in the report designer, please reply and i'll mark as solution.
I have a ssrs report, that gives me multiple product's price. My Parameter is not drill down, I have to type in the parameters(since I have large range of product number).
Now my questions is, how can i get the last entered product ( parameter) always appear at the bottom of the report ?. This would help me where to look the latest product in the report.For example I have product numbers like:
abc-234,
abc-570,
ght-908,
Now what I want is that the latest entered product number which is ght-908 to appear at the bottom of the ssrs reports. Right now it gives me the report for the multiple product, but its all over the place and i have to squint my eyes and try to find out where my most recent entered product numbers (parameters) is. I have also tried to stop the parameters to being refreshed everytime i add a product number.
Assuming your parameter name is MyParameter, in report designer (BIDS) just drop a textbox onto report below the data (e.g. Table) and put following expression into its value's formula:
=Parameters!MyParameter.Value.Split(",")(Parameters!MyParameter.Value.Split(",").Length - 1)
it will split the parameter list and grab the last value
Update: here is the screenshot with steps:
And here is the runtime result
This expression works for me:
=Trim(Right(Parameters!Product_Number.Value
, InStr(StrReverse(Parameters!Product_Number.Value), ",") - 1))
Trim might not be strictly necessary but is useful as it will work if the values are split with spaces as well as commas, or not.
For example:
It sounds like you want to order the results of the stored procedure by the order of the product codes as they are typed into the report parameter (which is a comma separated list).
You can return the index (order) of each product code in the parameter by using the Array.IndexOf and Split functions, e.g.
If you have a report parameter called "ProductNumber" and you also have a field called "ProductNumber" returned in your dataset, the following code will return the zero-based index of the Product Number as entered into the parameter list:
=Array.IndexOf(
Split(Parameters!ProductNumber.Value.ToString(), ",")
, Fields!ProductNumber.Value
)
So if abc-234 is the first product number in the parameter list then this code will return 0. If abc-570 is the second product number in the parameter list then this code will return 1, etc.
Assuming the products are listed in a tablix, then I would set the tablix sort expression to the above, which should sort the products into the order specified in the report parameter.