Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Banded Column Colors Expand / Collapse
Author
Message
Posted Wednesday, December 11, 2013 5:02 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, May 5, 2014 12:35 PM
Points: 4, Visits: 28
Hi
I have a data set that shows employees, dates, and sales

Employee........Date..............Sales
Raul...............2013-12-01.....100
Raul...............2013-12-02.....150
Raul...............2013-12-07.....350
Jose...............2013-12-01.....150
Jose...............2013-12-05.....100
Jose...............2013-12-06.....50
Pedro.............2013-12-04.....100
Pedro.............2013-12-07.....400

(i dont know how to format a table)

I want a report to look like

..............2013-12-01.....2013-12-02.....2013-12-03.....2013-12-04.....2013-12-05.....2013-12-06.....2013-12-07
Raul........100................150.......................................................................................................350
Jose........150.................................................................................100................50
Pedro.......................................................................100............................................................400

So I have a column group on dates
and I have a row group on employee

I want to be able to color the weekend a different color than the weekdays.

What I've been doing so far is, I have an expression per cell to set the background color. If the day of the week is 1 or 7, color it red, else blue.
The problem I have is that, if I have no data for that day for that person, I can't get the red.
For example, Pedro on 2013-12-01. He has no row/data for that day so that cell wont get colored red.

Any suggestions?
Post #1522101
Posted Thursday, December 12, 2013 7:18 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 6:31 AM
Points: 6,949, Visits: 7,060
The value should not matter as you are testing the date for the column.

Please post the expression you are using.

An example would be

=Choose(Weekday(Fields!Date.Value),"Red","Blue","Blue","Blue","Blue","Blue","Red")



Far away is close at hand in the images of elsewhere.

Anon.

Post #1522304
Posted Thursday, December 12, 2013 8:23 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, May 5, 2014 12:35 PM
Points: 4, Visits: 28
I'm using
=iif(Weekday(Fields!Date.Value)=1 OR Weekday(Fields!Date.Value)=7 ,"red", "Blue")
The expression you posted is doing the same thing.

Is there a way I can get the value of the column when I have no data for that cell?
Is there a different way to set the color that affects the entire column instead of doing all the cells individually?

Thanks
Post #1522333
Posted Thursday, December 12, 2013 8:48 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 6:31 AM
Points: 6,949, Visits: 7,060
Is there a way I can get the value of the column when I have no data for that cell?


Why?
Because you are using a matrix when you apply fill to the cell it applies to the whole column unless you specifically write the expression to do otherwise.

Is there a way I can get the value of the column when I have no data for that cell?

If the cell has no data then the value will be Nothing, ie =IsNothing(Fields!Sales.Value) will yield true
You can use this in the Fill expression if, for example, you wanted the background to white if no value.



Far away is close at hand in the images of elsewhere.

Anon.

Post #1522351
Posted Thursday, December 12, 2013 8:54 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, August 13, 2014 1:17 AM
Points: 44, Visits: 210
Try this:

=IIF(Weekday(ReportItems!HeaderDate.Value) = 1 Or Weekday(ReportItems!HeaderDate.Value) = 7,"Red","Blue")

and remember to change HeaderDate with the textboxId of the columnGroup

Let me now if it works


  Post Attachments 
Report.png (8 views, 12.08 KB)
Post #1522355
Posted Friday, December 13, 2013 6:43 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, May 5, 2014 12:35 PM
Points: 4, Visits: 28
Yup that worked.
Thanks! Now on to next set of problems.
Post #1522666
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse