SSRS Conditional Expression - sql-server

In SSRS report, I want to perform conditional color formatting where highest rank should be Green and lowest rank should be Red within a Regional Manager group as shown below
Note: Couple of options, I was thinking of includes
I am using custom code function, for deriving Min and Max value, and somehow if I can include grouping filter on Regional Manger then it could work, but don't know if that's possible
In dataset, I create extra columns for each column and store Min\max value in it. But less keen towards this option, since I have 24 different ranks and which would mean, I will need 24 different columns along with current 40 attributes
Any help would be appreciated

I know you don't want to do this for each column, but despite your misgivings it is probably the best approach. Based on my previous answer to your earlier related question you can colour the min and max for each group as follows.
Create a table with fields store, atvrank, and btvrank
Right click the row header, and select Add Group -> Row Group - Parent Group, and choose Regional Manager. Set the Group name to RegionalManagerGroup
Then set the background colour for your cells to
=iif(Fields!atvRank.Value = min(Fields!atvRank.Value, "RegionalManagerGroup"),
"Green",
iif(Fields!atvRank.Value = max(Fields!atvRank.Value, "RegionalManagerGroup"),
"Red",
"White"
)
)
This now finds the maximum and minimum within the current group instead of the whole dataset. You will need to set this expression for each field individually, but this is probably less effort than returning new rows from the database to determine the maximum and minimum for each field.
This approach will give the following output
Please seriously consider this solution. If you have further questions, please just ask.

Related

Issue with slicer Filtering from different data sets/ columns

I am having a problem trying to understand how to accomplish this. I want to use one set of slicers in my Excel spreadsheet to drill down to specific information. The problem is that I have duplicated Model names under the "Intel" worksheet. The reason is that Model Name could have one or two controllers. I have created all the queries, Power Pivots, and relationships. The link to the file is available here (this is all public data) if someone is willing to take a look and provide the guideline.
PROBLEM:
Due to Model Name's duplication under the "intel" worksheet, I have created a "DUP" column to identify duplicates in my data with the "X." I thought if I made a column “RELATED -Devide by 2” in the Power Pivot “Intel” with the formula =IF([DUP]="X," [RELATED - 12 Month Volume]/2, [RELATED - 12 Month Volume])", I would be able to show correct 12Month Volume based on Volume worksheet. This is partially true. I came to an understanding that I need to use both, “RELATED - 12 Month Volume” and “RELATED -Devide by 2” depending on what slicer I am filtering with
If Filtered by FORM Factor or Vendor, I can use RELATED - Divide by 2 (Orange color as shown below).
Now, if I filter above with Controller (like X710-TM4), this is not good. For Controller Filter, I would need to use “RELATED - 12 Month Volume” (Blue color as shown below), which is NOT suitable for above
How do I accomplish this? One set of slicers and be able to drill down and show correct value based on slicer used
enter image description here
Never mind... I figured it out with the CROSSFILTER measure

Merge duplicate rows where fields are different

These are my query results:
But I want to merge the MemberName column when the member is the same. But the values in the other columns still need to display separately. How can I make my report use the following format?
Create a Group for SIno at the lowest level, if you don't have one already. Suppress the header and footer of this group.
Then add this formula to the suppression logic for SIno, Member Name, and Sanity Code:
{SIno} = PREVIOUS({SIno})
After discussing your needs in the comments, I recommend the following: Set your report such that it doesn't have any borders, and instead have the background color alternate between white and gray. Group based on SIno if you haven't already, and set the background color to:
IF GROUPNUMBER MOD 2 = 0 THEN crWhite else crSilver
I do this all the time with my reports. It looks professional, and the customers understand it:

Ssrs reports Windows 2008

I'm fairly new to SQL and I have been issued my first report to build. I have written an SQL query to give me a set of results that I would like to publish in a report.
I have unioned about 20 small queries all containing the correct amount of columns. One column is a misc column with about 15 different descriptions in (this is what I want to count).
I have uploaded my data set and now want to be able to choose a cell in my report to bring back a certain description.
At the minute I'm using
=count(fields!misc.values)
and it's giving me the whole count, about 200.
I would like to know if there is any kind of "where clause" (filter) which I can use to state which description results I want to bring back.
You can use am expression to count the misc.value you need. It will work like a count using a where clause:
=Sum(iif(Fields!misc.Value ="Some description",1,0))
Example:
For count the FSMethod with MethodOne as value I used this expression:
=Sum(iif(Fields!FSMethod.Value ="MethodOne",1,0))
Note the expression sums by 1 if the FSMethod.Value is MethodOne.
For count the rows with FSMethod column with MethodTwo value.
=Sum(iif(Fields!FSMethod.Value ="MethodTwo",1,0))
Let me know if this can help you.

How do I calculate the percentage of a count function?

I am trying to take the percentage of a count function so to create a MS BIDS report resembling this excel file:
Excel Close Rate Summary
The unique identifier for the opportunities is the field "opportunityid", so I am using COUNT(Fields!opportunityid.Value) to determine the number of cases in each stage. I want to write an expression that will return the percentage of cases in each stage per creation month. Which can be seen in the above excel screenshot.
This is my current MS BIDS report when i preview it
To be more specific, I want to have the percentage of "Active" and "New" opportunities in January to represent 67% and 33% respectively. 67% comes from 4/6. The 4 comes from the active opportunities out of the 6 opportunities created in January. Likewise, the 33% comes from the 2 new opportunities out of the 6 that were created in January.
There are more stage names than Active and New. Other options include New, Warm, Hot, Implementation, Active, Hibernate or Canceled. This is relevant to mention because I have tried to create an expression that counts based on the number of opportunities with a specific stage name, but have been unsuccessful.
Currently the expression I am using to calculate the percentage is:
=COUNT(Fields!new_rptstage.Value)/SUM(COUNT(Fields!opportunityid.Value),"GroupbyStageName")
Based on this expression, I am only able to get 1/1 or 100% for each of the stage names. I have tried a bunch of variations of the above expression by changing the scope, but have been unsuccessful in getting the desired results. Can someone explain how to correct this?
SAMPLE DATA:
In the sample data, I want the expression to be in the percentage column. The percentage should be the # of cases in a particular stage for the total cases that month. So looking at the above picture:
Active February 54 54/168 [have 54/168 display as a percentage]
Warm February 8 8/168
etc.
EDIT:
These are the expressions that may help show the underlying data in the chart.
The creation month expression is
=Fields!MonthCreated.Value & " " & year(Fields!createdon.Value)
The percent expression is listed above.
You don't want to use the COUNT() function. COUNT(*) returns a count of the number of rows that have a value. It doesn't return the actual value.
Since you've only showed a screen shot of your report, I don't know how your underlying data columns relate to it, but what you want to do for your Percent column expression is this:
This is psuedo code because I don't know your dataset field names:
CaseCount.Value / SUM(CaseCount.Value)
EDIT: Now that I better understand how your data relates to your report, I think the only change you need to make to your existing formula is casting it to a decimal type. It's probably rounding all fractions up to 1.
Try this for the expression in your percentage column:
=CDbl(COUNT(Fields!new_rptstage.Value))/CDbl(SUM(COUNT(Fields!opportunityid.Value),"GroupbyStageName"))

SSRS Cumulative Running Values

So I am attempting to reorganize a report I put together. I had the running totals working before the redesign, but I have been pouring over this for a day and can't figure out why it is no longer functioning as I had thought.
The sum values are correct here, but it keeps accumulating them and not spreading them out over the area paths I've defined (which are populating obviously).
I have the sprint and area name linked in a hierarchy for the row groups then followed by this expression:
=RunningValue(Fields!Sev_1_Count.Value, SUM, "RowGroup")
Each column after the area name is defining a severity level of defects, just for context. The Sev_1_Count expression should take the count of all defects in this severity level then spread them across their associated area names. Which worked in the previous version... I just can't for the life of me figure why it won't work now. Thoughts?
I think the problem is that you're applying the running total to each field. It seems that wherever you're putting
RunningValue(Fields!Sev_1_Count.Value, SUM, "RowGroup")
you should just have
Fields!Sev_1_Count.Value
instead. As you need totals on both sides, you should have a matrix and the right and bottom rows of you columns should be outside the group "Iteration Name" with a value of
sum(Fields!Sev_1_Count.Value).
Not sure what I'm missing. Maybe your original dataset is set up in a way where you can't do that?
Your row groups should be grouped on name and your column groups should be grouped on severity level.
I'm not sure what you mean by your comment below Randy, but the best practice for something like this would be to have a data-set that consists of 3 fields:
"EnvironmentName", "DefectCount" and "SeverityLevel". Then in your matrix, you have the DefectCount as your Details, EnvironmentName as your RowGroup and SeverityLevel as your ColumnGroup. Then the right column and bottom row are placed outside the groups and have the value of Sum(DefectCount). Anything outside of that seems like an over-complication.
It seems like you want to use running total to add the columns for severity levels if i'm not mistaken? then you shouldn't be grouping them on rows. Instead of the "RowGroup" scope, maybe you should try None. Good luck.

Resources