How to divert to report with expression in SSRS - reporting-services

Hi I have a SSRS Report in which i get a table report.
╔══════════════╦════════════════╦════════════════╗
║ Company Name ║ Customer Count ║ Employee Count ║
╠══════════════╬════════════════╬════════════════╣
║ Company A ║ 1000 ║ 50 ║
╠══════════════╬════════════════╬════════════════╣
║ Company B ║ 2000 ║ 100 ║
╠══════════════╬════════════════╬════════════════╣
║ Company C ║ 3000 ║ 150 ║
╚══════════════╩════════════════╩════════════════╝
I want to go to report by Company Name.
Suppose if User click on Company A Then it should go to Report CompanyAReport.
If i click on Company B it should redirect to CompanyBReport.

To Achieve this scenario you have to create a separate report which will load details of the company.
So another report which might be drill down report of the company which gives list all Employees or customers of the company.
And you have to put the link on your report to redirect to another report with the parameters like.
In your report there will be tablix in which you will display all companies data. In that tablix textbox for CompanyName you have to open the property window like in below image.
in above image for textbox property there will be Action tab in that you can set action (href) where you want to redirect when user clicks on company name. You can also set the parameters of the report that you need to pass to open that report.

Assuming the company report will be the same for both Company A and Company B then..
Create a new report ()called say, _subCompanyReport) that takes a parameter CompanyName.
Build a dataset that gets the info you need e.g. SELECT * FROM myCompanyTable WHERE CompanyName = #CompanyName
Add whatever you need to show on that report.
Go back to your original report, right-click the company name cell and and choose textbox properties.
Click Action, select Go to Report, choose _subCompanyReport from the report list
Click Add to add a parameters, choose or type CompanyName (case sensitive) in the Name field and finally select the "Company name" column from your report in the Value field.
That's pretty much it. If you have problems, makes sure all parameter names are spelled correctly, they are case sensitive.

Related

Access ComboBox save value

I use a combobox to select value form a query. and make 2 columns in combobox.
the list will be
John 1
David 2
Michael 3
and expect when I selected John, will save 1 to table. but access save 0 to table, and if select David, will save 1. how can I save to Column 2 value to table?

Visual Studio SSRS - Count with a Group

Im trying to figure out an Expression in SSRS.
I have 1000s of account details in a DB.
What i want to do is create a table that gives a count of members in each state like :
State Members
AK 234
AL 654
AR 643
How do i add a subgroup to this expression
=CountDistinct(Fields!Agent_External_ID.Value)
Right now it results in the same person being counted twice as the state is not grouped.

SSRS Conditional Text Color Based On Other Group's Value

To simplify my need: I am comparing a projected sales number to the budgeted sales number and need to color the Projected amounts as red, black, or green, based on whether they are less, equal, or greater than the corresponding Plan amounts. Essentially my data boils down to
║ Group ║ Amount ║ Type ║
╠═══════╬════════╬═══════════╣
║ 1 ║ .95 ║ Projected ║
║ 2 ║ 0 ║ Projected ║
║ 3 ║ .04 ║ Projected ║
║ 1 ║ 1.3 ║ Plan ║
║ 2 ║ 0 ║ Plan ║
║ 3 ║ .03 ║ Plan ║
My tablix is using a column grouping based on the Type.
I tried the following Expression, but it's giving me Green when it should be Red.
=iif(SUM(Fields!Amount.Value)<SUM(iif(Fields!Type.Value = "Plan",Fields!Amount.Value,0),"Type"),"Red",iif(SUM(Fields!Amount.Value)>SUM(iif(Fields!Type.Value = "Plan",Fields!Amount.Value,0),"Type"),"Green","Black"))
My desired output is the following:
I think it would be easier if you change your query to retrieve the data in a different way. However I'll expose a SSRS and a T-SQL solution:
SSRS Solution:
Add a calculated field to your dataset and concatenate the Group and Type.
=Fields!GroupID.Value & "-" & Fields!AmountType.Value
I am using the data you put in your question in order to recreate your scenario. Supposing you are using a matrix to get the desired output just use this data arrangement:
Now in Amount cell font color property use the following expression:
=IIF(
Fields!AmountType.Value="Projected",
IIF(
Fields!Amount.Value >
Lookup(Fields!Group.Value & "-" & "Plan",Fields!GroupType.Value,Fields!Amount.Value,"DataSet3"),
"Green",
IIF(
Fields!Amount.Value <
Lookup(Fields!Group.Value & "-" & "Plan",Fields!GroupType.Value,Fields!Amount.Value,"DataSet3"),
"Red","Black"
)
),"Black"
)
You have to change Fields!GroupType.Value according to the name you set for the calculated field.
It will preview the following matrix:
This solution will only work if you compare only two different types:
Projected and Plan
T-SQL Solution (recommended):
Change your dataset query to get the data in a proper way to compare it. Based on the table you posted I've used this query.
SELECT
a.GroupID,
a.Amount [Projected],
pl.Amount [Plan]
FROM your_table a
INNER JOIN (SELECT
*
FROM your_table
WHERE AmountType = 'Plan') pl
ON a.GroupID = pl.GroupID
WHERE a.AmountType = 'Projected'
It produces:
Try yourself by this fiddle:
With the T-SQL solution the comparation between plan amount and projected amount is trivial in SSRS.
Let me know if this helps you.
I think your issue is that you are comparing the total of Projected + Plan with Projected so it would always be greater.
=IIF(SUM(IIF(Fields!Type.Value = "Projected", Fields!Amount.Value, 0)) < SUM(IIF(Fields!Type.Value = "Plan",Fields!Amount.Value,0),"Type"), "Red",
IIF(SUM(IIF(Fields!Type.Value = "Projected", Fields!Amount.Value, 0)) > SUM(iif(Fields!Type.Value = "Plan",Fields!Amount.Value,0),"Type"), "Green", "Black"))

Remove Duplicates in SSRS Subreport

I have an SSRS report the links a line item subreport to my main report by an order number. When a customer orders 2 line items, 2 order numbers come in with contact info, etc. In the SSRS report, the order number shows up twice and the multiple line items fall below. What I would like is the 1 order number with the line items following.
As I have it now it looks like:
Order# Contact User
1234 J. Smith JS1
LineItem Qty Order Date
1 3 05/15/2015
2 2 05/15/2015
Order# Contact User
1234 J. Smith JS1
LineItem Qty Order Date
1 3 05/15/2015
2 2 05/15/2015
I tried =Fields!LineItem.Value =PREVIOUS(Fields!LineItem.Value) but because the dup isn't directly previous that didn't work.
But I'd like to have just one single result. Any help would be great.
At the bottom of your design screen should be the Row Groups window. Many times, you will already have a group created. If you right click on it and click the properties it should look something like the image below:
Thanks.

SSRS Reports: Drill down with custom columns in each sub-grouping

I want to be able to group information (no problem) but be able to show a completely different set of columns when the grouping icon ('+') is selected. For Instance, lets say the top level report is:
DEPARTMENT | MANAGER | BUDGET # | TOTAL SALES
Expand DEPARTMENT and get
MANAGERS | COST CENTER | NUM EMPLOYEES | Q1 SALES | Q2 SALES | Q3 SALES | Q4 SALES | ANNUAL TARGET
and so forth; there could be one or 2 more drill downs each with different columns. Is this possible? Thanks in advance.
First of all, name the textboxes containing the top level items.
If you right click on the group that you want to be toggled by the top level report item and select 'Group properties', you can select visibility and there is an option for 'Display can be toggled by this report item' If you click the dropdown, you should be able to find the names of the textboxes.
Repeat this for each of the groups, and the textboxes that you want to toggle them. 'When the report is initially run' does exactly what it says on the tin, so set it appropriately.