Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 824
  • Last Modified:

highlight, turn bold field based on condition in another field

I have a report with a column numeric name: cost change.

I would like to highlight and turn the font to bold in some cells when the value in cell cost change fluctuates +/- 2 cents.

Is there any chance someone can show me how the IIF would need to be coded?

Thank you.
0
metropia
Asked:
metropia
1 Solution
 
metropiaAuthor Commented:
I have this expression that does not work how I want it to work:

CASE
    WHEN (SUM(FavUnfavCostChange) < (2/100) THEN 'Less'
    WHEN SUM(FavUnfavCostChange) > (2/100) THEN 'More'
    ELSE NULL
END AS 'Flag'

But I get:

0.00000815000000000000            More    -- this is not more than 2 cents, is just a positive number
-0.00094700000000000000            Less     -- this is not less than 2 cents, is just negative number
-0.00222000000000000000            Less     -- this is not less than 2 cents, is just negative number
-0.00012250000000000000            Less     -- this is not less than 2 cents, is just negative number
0.00000000000000000000            NULL    -- this is zero so null is fine
0.01188576000000000000            More    -- this is not more than 2 cents, is just a positive number
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Since the only topic in this question is MS SQL Reporting, assuming this is in SSRS, you can edit the text properties by clicking on the text box, then right-click:Text Box Properties, then...

Fill Color, hit the fx button to the right of the Fill Color combo box, and in the Expression Editor enter this expression
=IIF(ABS(Fields!COST_CHANGE.Value) > .02, Yellow, White) 

Open in new window

... and Font, hit the fx button to the right of Bold, and in the Expression Editor enter this expression
=IIF(ABS(Fields!COST_CHANGE.Value) > .02, True, False) 

Open in new window

Change the name of the column, Yellow to whatever color floats your boat, and if  'cost change fluctuates +/- 2 cents.' means anything other than the absolute value of that column being greater than .02, we'll need to work with the expression.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now