SSRS multiple right IIF / SWITCH query - reporting-services

I want to change values to display in a report based on the right 3 characters of the column name..
=SWITCH (Right(Fields!Column_Name.Value,3) = "Pred", "Green",
(Right(Fields!Column_Name.Value,3) = "Lvl", "Blue")

Related

Conditionally format certain cells of tablix

Using Visual Studio 2017 (SSDT), I have a tablix where I would like to use an expression to set the background color/fill. I would like the cells to fill gray where the:
2019 Metal is Silver and 2020 Metal is Bronze, or
2019 Metal is Gold and 2020 Metal is Bronze, or
2019 Metal is Gold and 2020 Metal is Silver.
Visually, like this:
The data set populating the tablix is:
(I added custom "Is Null" code to display zeros instead.)
I've been trying IIF statement logic but have been unable to get my desired results.
The design of the tablix is:
I'm trying to set the Fill BackgroundColor on the textbox here with an expression:
...using something like:
=IIF(
Fields!METAL_YEAR_2020.Value="Bronze" AND
(Fields!METAL_YEAR_2019.Value = "Silver" OR Fields!METAL_YEAR_2019.Value = "Gold")
, "Gray"
, "Transparent"
)
If I leave out the OR condition I can fill one intended cell, but I don't know how to account for the three cells.
So, this code below sets one cell but can I nest or SWITCH to set the three cells I want?
= IIF(
(
(Fields!METAL_YEAR_2019.Value = "Silver" and Fields!METAL_YEAR_2020.Value = "Bronze")
OR (Fields!METAL_YEAR_2019.Value = "Gold" and Fields!METAL_YEAR_2020.Value = "Bronze")
OR (Fields!METAL_YEAR_2019.Value = "Gold" and Fields!METAL_YEAR_2020.Value = "Silver")
)
, "Gray", "White")
since there is no data where you get the null values (not only the integer value is absent, but all values, you have to refer to the group value, which is in the textbox)
= iif(
(cstr(ReportItems!Metal_2019.Value) = "Silver" AND cstr(ReportItems!Metal_2020.Value) = "Bronze") OR
(cstr(ReportItems!Metal_2019.Value) = "Gold" AND (cstr(ReportItems!Metal_2020.Value) = "Silver" OR cstr(ReportItems!Metal_2020.Value) = "Bronze")),
"Gray","Transparent")
found at

How do I add calculated value as a group in a pie chart using SSRS?

I'm trying to understand how to plot data to a pie chart using calculations versus grouping.
I've tried series and category grouping:
=Switch(Left(Trim(Fields!WaybillNumber.Value),2) = "SA", "SA",
Left(Trim(Fields!WaybillNumber.Value),2) = "JU", "JU")
The easiest way would be if you add a calculated field in your dataset with your expression,
=Switch(Left(Trim(Fields!WaybillNumber.Value),2) = "SA", "SA",
Left(Trim(Fields!WaybillNumber.Value),2) = "JU", "JU")
and then simply drag and drop your calculated field into the pie chart.

ssrs show text different colour when field matches with another field

I have a requirement to show different text color when one field matches with another three different fields.
I have written below expression,
=IIF(Fields!OrderBlockLetter.Value = Fields!InstitutionBlockLetter.Value or Fields!DegreeBlockLetter.Value or Fields!AwardBlockLetter.Value, "Green", "No Color")
But its not working.
I am using SSRS report builder.
That's not how the OR works.
You would need to use something like..
=IIF(Fields!OrderBlockLetter.Value = Fields!InstitutionBlockLetter.Value or Fields!OrderBlockLetter.Value = Fields!DegreeBlockLetter.Value or Fields!OrderBlockLetter.Value = Fields!AwardBlockLetter.Value, "Green", "No Color")

SSRS Pie chart hide 0 Value

SQL Server 2012 - SSRS Questions
I currently have a Pie chart that shows the number of deliveries as a percentage on whether they are late, on time or early. What I am trying to do is use an Expression in the Chart Series Labels "Visible" property to hide the label if it is 0 on the chat. Of note in the table this value is returned as 0.00 I have tried using various SWITCH and IFF Statements to do this but nothing seems to work and its likely I am getting the syntax wrong, can anyone help?
Table Values
TotalIssued Early Late OnTime EarlyPerc LatePerc OnTimePerc
6, 0, 4, 2, 0.00, 66.67, 33.33,
=SWITCH(
(First(Fields!EarlyPerc.Value, "EstimatesIssued") = 0),false,
(First(Fields!LatePerc.Value, "EstimatesIssued") = 0),false,
(First(Fields!OnTimePerc.Value, "EstimatesIssued") = 0),false,
true)
Thanks
Try:
=SWITCH(
First(Fields!EarlyPerc.Value, "EstimatesIssued") = 0,false,
First(Fields!LatePerc.Value, "EstimatesIssued") = 0,false,
First(Fields!OnTimePerc.Value, "EstimatesIssued") = 0,false,
true,true)
UPDATE:
If you have one field per percentage and your dataset returns one row always, you have to select each serie in the ChartData window and press F4 to see properties window.
In properties window set for EarlyPerc Visible property:
=IIF(Fields!EarlyPerc.Value=0,False,True)
And so on for the next two series you have (LatePerc and OnTimePerc).
Let me know if this helps.

To handle the increment and decrement of a value in an expression and display the corresponding indicator SSRS reporting service

I have a table table of values displayed in SSRS .
The table has fields metricID , currentmonth , preciousMonth
Questions :-
1. I have to compare 2 values like current month and previous month
Fields.PreviousMonth.Value < Fields.CurrentMonth.Value
THEn Check if the metric id is metricID is 7 then increase in currentmonth should be displayed as up arrow with red colour else it should be downarrow with green colour.
For all other Metric ID's it should be "upp arrow with green colour" else "down arrow with red colour"
Does anybody have an idea on how to do this
To do this you will need to set up custom indicators and set an appropriate expression to set the indicator.
I have some simple data:
And a simple report with an indicator per row:
The indicator is set up as:
Where the expression is:
=Switch(Fields!MetricID.Value = 7 and Fields!CurrentMonth.Value - Fields!PreviousMonth.Value > 0, 1
, Fields!MetricID.Value = 7, 2
, Fields!MetricID.Value <> 7 and Fields!CurrentMonth.Value - Fields!PreviousMonth.Value > 0, 3
, true, 4)
So what I'm doing is assigning each row a specified state based on your business rules, and I've set appropriate icons for each of those states.
Report is working as required:
You could move the expression above into a calculated field in the Dataset if you needed to use it in multiple places in the report.