Conditionally formatting cells in SSRS with mixed data types in a sentence.

sidhartha bhatnagar 1 Reputation point
2020-12-20T21:18:28.763+00:00

I am trying to achieve this:

I have got two parts of it i.e Iff Z < 3 then " Orange "

iff Z > 3 then "Green"

iff Z <0 then "Red" <- To achieve.

I have used iff, instr to see if it would work and color the cell but its not. The other two conditions work however, the 1 Overdue does not change to red. I guess it is a character or numerical data type issue. Would appreciate any assistance.

X Y Z

a b '1 Overdue'

c d '2' <- Got it

e f '4' <- Got it

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,935 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Joyzhao-MSFT 15,596 Reputation points
    2020-12-21T02:10:17.887+00:00

    Hi @sidhartha bhatnagar
    Try the following query:

    =Switch(Fields!Rank.Value<3 and Fields!Z.Value >=0,"Orange",Fields!Z.Value> 3,"Green",Fields!Rank.Value <0,"Red")  
    

    I tested it locally, and I used the following statement to query:
    49855-01.jpg

    =Switch(Fields!Rank.Value<=3 and Fields!Rank.Value >1,"Orange",Fields!Rank.Value> 3,"Green",Fields!Rank.Value <= 1,"Red")  
    

    The output is as shown below:
    49843-02.jpg

    The above test is for your reference. Hope this helps.
    Regards,
    Joy


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    What can I do if my transaction log is full?--- Hot issues November
    How to convert Profiler trace into a SQL Server table -- Hot issues November

    0 comments No comments

  2. Joyzhao-MSFT 15,596 Reputation points
    2020-12-24T09:54:13.167+00:00

    Hi,

    Has your issue been resolved?

    If you have any question, please feel free to let me know.

    If the answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.