Breaking report layout by column grouping in sql report

Hello All,
I have a strange requirement where I have a query which needs to o/p data in the following manner:
Status Exp. Type Class Entered By Expenditure Group Control Total Running Total
Submitted Miscellaneous XXXX, Mrs. YYYYY DESAF130501-001 0 .00
Transaction
AAAA, Mrs. BBBBBB DEAMK070509-07 77.05 77.05
CCCCC, Mr. DDDDDDDD B9MM080509-06 0 .00
B9MM070509-04 0 .00
B9MM110509-01 0 .00
B9MM080509-03 0 .00
B9MM070509-05 0 .00
B9MM080509-07 0 .00
B9MM080509-04 0 .00
B9MM080509-01 0 .00
B9MM130509-01 0 .00
B9MM070509-03 0 .00
B9MM080509-02 0 .00
B9MM110509-02 0 .00
B9MM070509-07 0 .00
B9MM110509-04 0 .00
B9MM070509-02 0 .00
B9MM070509-01 0 .00
B9MM120509-01 0 .00
B9MM110509-03 0 .00
FFFFF, Miss WWWW DEARM110509-01 0 142.78
GGGGG, Mr. HHH ALPM080509-1 0 .00
LLLLL, Mrs. KKKKKKK JKDTest070709-1 20 20.00
Total for Expenditure Type Class: 23 97.05 239.83
So basically the sql query groups by status,exp type class,enteredby,expenditure group.My problem is the user does not want the column values to be repeated for every record inside the group.For Eg: if you see under the group by the entered by : CCCCC, Mr. DDDDDDDD
The value CCCCC, Mr. DDDDDDDD is displayed only once for the group even though there are more than several records under the group(due to unique records in expenditure group).
It is pretty straight forward to do in Oracle Reports or in SQL* Plus using Columns BREAK,but iam struggling to do the same thing in plain sql...Any suggestions?

Oh .Got you..thanks..This is the o/p i require...
     Status             Exp. Type Class      Entered By                Expenditure Group            Control Total     Running Total
     Submitted          Miscellaneous        XXXX, Mrs. YYYYY          DESAF130501-001                          0               .00
                        Transaction
                                             AAAA, Mrs. BBBBBB         DEAMK070509-07                       77.05             77.05
                                             CCCCC, Mr. DDDDDDDD       B9MM080509-06                            0               .00
                                                                       B9MM070509-04                            0               .00
                                                                       B9MM110509-01                            0               .00
                                                                       B9MM080509-03                            0               .00
                                                                       B9MM070509-05                            0               .00
                                                                       B9MM080509-07                            0               .00
                                                                       B9MM080509-04                            0               .00
                                                                       B9MM080509-01                            0               .00
                                                                       B9MM130509-01                            0               .00
                                                                       B9MM070509-03                            0               .00
                                                                       B9MM080509-02                            0               .00
                                                                       B9MM110509-02                            0               .00
                                                                       B9MM070509-07                            0               .00
                                                                       B9MM110509-04                            0               .00
                                                                       B9MM070509-02                            0               .00
                                                                       B9MM070509-01                            0               .00
                                                                       B9MM120509-01                            0               .00
                                                                       B9MM110509-03                            0               .00
                                             FFFFF, Miss WWWW          DEARM110509-01                           0            142.78
                                             GGGGG, Mr. HHH            ALPM080509-1                             0               .00
                                             LLLLL, Mrs. KKKKKKK       JKDTest070709-1                         20             20.00
                        Total for Expenditure Type Class:              23                                   97.05            239.83

Similar Messages

  • SQL Server Reporting Services- Coloring a Cell Background Based on two different column group values

    Hello All,
    I have a matrix report with time scale on the x axis  and Resources on Y axis Showing the tasks assigned to each resource for a period of time. Here I have to color a matrix cell showing task details on tool tip with background color of the cell.
    So Please help me on this.I have a expression like this...
    In my case the color should be filled for the cell with name "Fields!task_name.Value" based on the values of "Fields!Day_Wise.Value " where we have the values for Daywise as S,M,T,W,T,F,S. So i need the background for the cell with name
    task_name as Light Grey on Friday and Saturday, But we have the same name S for sunday also, which should come in different color.
    =iif(Fields!Day_Wise.Value ="F","LightGrey",
    IIF(PREVIOUS(Fields!Day_Wise.Value) ="F","LightGrey",
    iif(Fields!task_name.Value="","White",
    iif(InStr(Fields!task_name.Value,"||")>0,"Maroon",
    iif(InStr(Fields!task_name.Value,"NULL")>0,"Sienna",
    iif(InStr(Fields!task_name.Value,"Pink")>0,"Pink",
    iif(InStr(Fields!task_name.Value,"Red")>0,"Red",
    iif(InStr(Fields!task_name.Value,"Purple")>0,"Purple",
    iif(InStr(Fields!task_name.Value,"Green")>0,"Green",
    iif(InStr(Fields!task_name.Value,"White")>0,"White",
    iif(InStr(Fields!task_name.Value,"Cyan (Teal)")>0,"Teal",
    iif(InStr(Fields!task_name.Value,"Olive")>0,"Olive",
    iif(InStr(Fields!task_name.Value,"Blue")>0,"Blue",
    iif(InStr(Fields!task_name.Value,"Light Blue (Aqua)")>0,"LightBlue",
    iif(InStr(Fields!task_name.Value,"Yellow")>0,"Yellow","Black"
    Thanks
    AJ Hameed

    Hi AJ Hameed,
    According to your description, you want to set the background color for the cells based on the values inside of cells and the values the column group. You want to set grey for cells on Friday and Saturday, set colors based on the task name on other weekdays.
    Right?
    In Reporting Services, there's no problem if we have two different data values in conditional expression, so we can set background color based on Day_Wise or task_name. One issue in this scenario is, we can't have value "S" for both Saturday and Sunday when
    working in a matrix. Otherwise the task_name will overwrite the previous task_name (for numeric values, it will do sum calculation). So we suggest you change the values for weekdays in database. The expression you have posted was correct. It only has a small
    issue: the "Light Blue(Aqua)" also contains "Blue", so when doing conditional judging, the expression will return "Blue" instead of "Light Blue". We have tested in our local environment. For viewing convenience, we used the Switch() function in our expression:
    =IIf(Fields!Day_Wise.Value="Fri" or Fields!Day_Wise.Value="Sat","LightGrey",
    Switch(
    InStr(Fields!Task_name.Value,"White")>0,"White",
    InStr(Fields!Task_name.Value,"||")>0,"Maroon",
    InStr(Fields!Task_name.Value,"Pink")>0,"Pink",
    InStr(Fields!Task_name.Value,"Red")>0,"Red",
    InStr(Fields!Task_name.Value,"Purple")>0,"Purple",
    InStr(Fields!Task_name.Value,"Green")>0,"Green",
    InStr(Fields!Task_name.Value,"Cyan(Teal)")>0,"Teal",
    Fields!Task_name.Value="","White",
    InStr(Fields!Task_name.Value,"Olive")>0,"Olive",
    InStr(Fields!Task_name.Value,"Blue")>0,"Blue",
    InStr(Fields!Task_name.Value,"Aqua")>0,"LightBlue",
    InStr(Fields!Task_name.Value,"Yellow")>0,"Yellow",
    InStr(Fields!Task_name.Value,"Orange")>0,"Orange",
    InStr(Fields!Task_name.Value,"Null")>0,"Sienna",
    true,"Black"
    The result looks like below:
    Reference:
    Matrices (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • Problem with column groups on Interactive Report

    Hi
    I am hoping that someone can help with this problem.
    I am attempting to control both the grouping and ordering within each group of fields in the single row view of an interactive report. Creating column groups appears to be OK at first (sequence, name and description) but if I then attempt to edit the group, the sequence box appears to be empty even though it was filled with a unique number at the time of creating the group.
    In addition, any changes to the order of the fields within the group made using the shuttle box at the bottom of the screen don't seem to be saved even to the Apply Changes button is pressed.
    Anybody know what is happening here and can anyone suggest how to control both the order of the groups and ordering within each group?
    Thanks in anticipation
    Martin

    Moun wrote:
    I am dealing with many interactive projects in my application. Sometimes I have to add a column to the interactive report. When I do so, the column doesn't appear in the interactive report...On the page I have to click on "Actions" then go to "Selected columns" and then display it ! the problem is when I logout and login again
    the column desappear again and I have to do samething again and again...Is there a way to set it appear by defaul always ???After adding new columns to an existing IR, you need to select them for display as a developer, and save the new report as the Primary Default.

  • Expression Error in Column Group report display

    Logic # 1:  If Column Group: Region. Value is EQUAL to "America Hub", the Value section needs to pull "Rev_Rec Date" Field.
    Logic # 2: If Column Group: Region. Value is EQUAL to "EMEA" or "AMERICA" or "ASIA", the Value section needs to pull "Order Date" field.
    Below is the column group expression I have entered.  However, it displays as “ERROR#” in the report output.  
    I am not sure why the SSRS program show an error in Column Group in Matrix report format
    =sum(IIf(Fields!REGION.Value = "America Hub", Fields!Rev_Rec_Date.Value, Fields!Order_Date.Value))
    Appreciate if you can help me.
    Thanks,
    Josey
    Josey Tang

    Hi Qiuyun,
    Thanks for your feedback and example.  Appreciated.
    I have created 2 expressions. One is in Row Group and the other in Column Group in order to show different values in Row and column fields.
    ROW FORMAT
    Logic # 1:  If Row Group: Region. Value is EQUAL to "America Hub", the Value section needs to pull "Billing Amount" Field.
    Logic # 2: If Row Group: Region. Value is EQUAL to "EMEA" or "AMERICA" or "ASIA", the Value section needs to pull "Booking Amount" field.
    Expression in ROW FORMAT:
    =sum(IIf(Fields!REGION.Value = "America Hub", Fields!Billing_Amount.Value, Fields!Booking_Amount.Value))
    COLUMN FORMAT
    Logic # 1:  If Column Group: Region. Value is EQUAL to "America Hub", the Value
    section needs to pull "Rev_Rec Date" Field.
    Logic # 2: If Column Group: Region. Value is EQUAL to "EMEA" or "AMERICA" or "ASIA",
    the Value section needs to pull "Order Date" field.
    Expression in “COLUMN FORMAT”:
    =sum(IIf(Fields!REGION.Value = "America Hub", Fields!Rev_Rec_Date.Value, Fields!Order_Date.Value))
    The Row Group expression is working properly.  However the Column Group expression shows as ERROR #
    I think I need to help based on the Column Group Logic # 1 and 2 above.
    Josey Tang

  • ClariFit IR Column Grouping not work when Control Break

    Dear,
    i am using ClariFit IR Column Grouping plugin for grouping column heading. Plugin is working fine. But when user use the Actions --> Format ---> Control Break option, the grouping column
    disappears,
    Can some body provide help on this issue or any alternate.
    Regards,

    Regardless of the limitations of IR, having quick access to controls significantly improves the experience.
    Having used the Remote app more than usual in the last few days with my new speakers, I'm reminded of how terrible an app it is if you just want to get in and out quickly -- the Library must load every time you open the app, and then once it does load, you can only use it for a few seconds until it inexplicitly kicks you to the "Now Playing" screen. And this happens every single time you open the app or unlock your phone.  So tasks that should be quick such as pausing, skipping tracks, or adjusting the volume take 15-20 seconds.
    With an IR remote, those tasks are instantaneous.  It doesn't excuse the fact that the iPhone app needs an overhaul, which is a separate issue.

  • SQL Modeler : Column Groups

    Is the Column Group option (under Table Properties) not yet implemented?
    It does not seem to save a column group and the topic is skipped in the Help File for the Table Properties topic.
    Edited by: user635766 on Jul 9, 2009 6:08 AM

    Hello,
    thanks for feedback. I checked it - you can add groups, change columns belonging to them and they are saved. Unfortunately group cannot be deleted and change in the name of the group is not applied if press OK while in editing mode.
    I logged bugs for these problems.
    Philip

  • Table with column group (one column) - next row is showing on new page instead of below previous row

    I am creating new table. My goal is to display some text in few lines like this:
    "AAAAAAAA"           "BBBBBBBB"           "CCCCCCCCC"     
    "DDDDDDD"           "EEEEEEEE"
    Actually the next row (with "DD" and "EE" values) is not displayed below first row, but on the next page.
    I've tried to put table into rectangle, disabled all page breaks and still the same effect. Any help?

    Hi Heidi,
    Actually, it's not solution, I only gave more details about my problem :)
    Another description:
    In my report I'm creating Tablix with Column grouping. There is only one column with image (every image has same width). If there is only three pictures, then they are displayed next to each other in one row.
    In case, there is more than three pics, another row is showing on next page. I'd like to display all rows one after another on one page.
    I've tried to create three vertical lists, and filter each column group to display only records:
    1) =(RowNumber("Tablix1")) mod 3 = 1
    2) =(RowNumber("Tablix1")) mod 3 = 2
    3) =(RowNumber("Tablix1")) mod 3 = 0
    Unfortunately, I got an error:
    "A FilterExpression for the tablix ‘Tablix1’ uses the function RowNumber.  RowNumber cannot be used in filters."
    Do You have any other propositions?
    --------EDIT--------
    ok, I manged to solve it. As I said, I've created three vertival lists and placed them next to each other.
    Then, instead of using filter, I've used Visibility trigger:
    1)
    =IIf(RunningValue(Fields![rowgroupfield].Value, COUNTDISTINCT, "Tablix1") mod 3 = 1, false, true)
    2)
    =IIf(RunningValue(Fields![rowgroupfield].Value, COUNTDISTINCT, "Tablix2") mod 3 = 2, false, true)
    3)
    =IIf(RunningValue(Fields![rowgroupfield].Value, COUNTDISTINCT, "Tablix3") mod 3 = 0, false, true)
    I had to use function RunningValue to count all occurrences, as my report is quite complex and "RowNumber" [ssrs function] and "ROW_NUMBER() OVER (ORDER BY [rowgroupfield])" [sql query] were not working properly.

  • SSRS 2008 R2 - Add moving average to column group

    I have a column group of dollar amounts.  The row is a year/month.  I would like to add a moving average column to the right of the last 6 months.  My SQL Server data source is already complex enough and I'd really prefer not to add a column
    there.  Is there anything I can do within the report itself?  Some way to reference the previous records in a matrix?
    Thank you!

    Hi mateoc15,
    According to your description, you have a matrix in your report. Now you want to calculate the average value of last 6 month. Right?
    In Reporting Service, we can put custom code into report to deal with complicated logic. Add one more column/row inside of group and call the functions defined in custom code. For your requirement we modified Robert’s code to achieve your goal. We tested
    your case in our local environment with sample data. Here are steps and screenshots for your reference:
    Put the custom code into report:
    Private queueLength As Integer = 6
    Private queueSum As Double = 0
    Private queueFull As Boolean = False
    Private idChange As String=""
    Dim queue As New System.Collections.Generic.Queue(Of Integer)
    Public Function CumulativeQueue(ByVal currentValue As Integer,id As String) As Object
    Dim removedValue As Double = 0
    If idChange <> id then
            ClearQueue()
                    idChange = id
                    queueSum = 0
                    queueFull = False
                    CumulativeQueue(currentValue,id)
    Else
                    If queue.Count >= queueLength Then
                                    removedValue = queue.Dequeue()
                    End If
                    queueSum += currentValue
                    queueSum -= removedValue
                    queue.Enqueue(currentValue)
                    If queue.Count < queueLength Then
                    Return Nothing
                    ElseIf queue.Count = queueLength And queueFull = False Then
                    queueFull = True
                    Return queueSum / queueLength
                    Else
                    Return (queueSum) / queueLength
                    End If
    End If
    End Function
    public function ClearQueue()
    Dim i as Integer
    Dim n as Integer = Queue.Count-1
    for i=n To 0 Step-1
                    queue.Dequeue()
    next i
    End function
    Add one more row inside of group, call the function defined in custom code.
    Save and preview. It looks like below:
    Reference:
    Moving or rolling average, how to?
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou (Pactera)

  • How to create RunningValue Through Column Groups?

    Hi Everybody i´m trying to do this with a Matrix
    I want the running value of the product quantity for each month of a year,
    resetting the running value
    when a new year is reached
    I have 2 column groups "Year" and as it´s child group "Month".
                         2009                                  
    2010
                         January Febrary March      January   February  March
    Product
    Toolbelt            10           15       20             
    1            10            50
    Well that is the idea...
    In the field of the quantity i´m using an expression like this = RunningValue(Fields!Quantity.Value, Sum, Nothing) .
    With this expression i get the the running value and it´s great, but
    it does not reset thru the years ,
    it continues aggregating the quantity value.
    So i tried with this expression assuming if i set the SCOPE to the Year group i can achieve this
    = RunningValue(Fields!Quantity.Value, Sum, "Year") ,
    But surprise!!, this is not giving me the right aggregation , i´m still dig in it and can´t find what it actually aggregates.
    Am I doing something wrong?.
    All the help is welcome. Thanks.

    Hi UzielB,
    Based on your information, I get your requirement completely, here you want to accumulate the value of month from
    Jan to March whin one year, then return to Jan again whin another year. If I misunderstand you please do not hesitate to let me know.
    Now the issue you are encountering is that the value does not reset through the different years.
     Actually, nomatter it is 2009 or 2010, RunningValue function takes different years as the same scope, so the value does not reset
     through the different years. Just like picture3.
    To workaround the issue, we might need to utilize the subreport in the main report, for detailed steps please follow
    these:
    1.    
    Design the subreport with two column groups
    Year, Month and one row group Product.
    2.    
    Type in the expression in the data textbox
    =RunningValue(Fields!Yourdatafield.Value,sum,"Product") Here
    Product is the row group name.
    3.    
    Add one parameter
    Year to the subreport, of course you should add the parameter year behind the where clause in the T-sql. Such as
    select * from yourtable where Year=@Year
    4.    
    Delete the
    Year column and Product column, here please make sure you just delete the column only rather than deleting the relevant reportitem.
    5.    
    Decrease the height and width of the report to the report control size, then there is no blank space when displayed in the main report.
    6.    
    Drag a matrix to the main report, just add one column group
    Year.
    7.   
    Then drag a subreport control into the data textbox, and then rigth-click the subreport control->select subreport
    properties
    8.   
    In the Subreport Properties dialogbox, please selec the subreport name in the drop-down list of
    Use this report as a subreport
    9.    
    Swith to
    Parameter tab, click Add button to add a parameter, then select the
    Year in the Name drop-down list and
    Year datafield in the Value drop-down list.
    10.  
    Click OK.
    11.  
    Now add another table control into the 
    main report body with one column, and drag the product datafiled into the data textbox. Then group the table by
    Product.
    12.  
    Drag this table into the
    Rows  textbox of the main report. Here make sure the height of the rows in Subreport and table creted in step11 is the same, otherwise the lines in not stay in the same level.
    Preview the report, you will see the report like picture2.
    If you have any question about the steps, please feel free to ask.
    Have a wonderful day
    J
    Challen Fu

  • Need a multi-level control break report displaying a cross-tab for each ...

    I need a multi-level control break report that displays a cross-tab report for each
    detail and subtotal. The individual cross-tabs are no problem. There are two issues:
    1) How to get many cross-tabs (thousands) to appear in one report.
    2) How to provide cross-tabs in-line on the multi-level subtotal lines.
    Here is a concrete example.
    Suppose the data base contains this table:
    road (
    id_number number, -- this is an artificial PK
    city varchar2,
    county varchar2,
    state varchar2,
    length number,
    owner varchar2, -- roads may be owned by cities, counties, states, and others
    surface_type varchar2 -- the surface type may be gravel, asphalt, concrete, and others
    The table is populated with several million records that include every
    length of road in a US city.
    It is OK to suppose that all the attributes in all the records are not null.
    Without the PK, there would be millions of duplicates,
    which should all contribute to the summed lengths.
    The report I need is like a control break report with a detail line for each
    city together with subtotals for each county and state and
    a grand total for the US at the end.
    However, each detail and total line needs to be a cross-tab report
    summing the length over the city, county, state or US
    (whichever is called for at that location)
    for each combination of owner and surface_type.
    so the report would have the following structure:
    a city cross-tab for the first city in county 1/state 1
    a city cross tab for the last city in county 1/state 1
    a cross-tab for count 1
    a city cross tab for the first city in county 2/state 1
    a city cross tab for the last city in county 2/state 1
    a cross tab for state 1
    a cross-tab for the US
    Any suggestions will be appreciated.
    This problem comes up because my client's legacy system,
    which is being replaced,
    already has such a report (in COBOL).
    Thanks!!!
    Steve
    PS, I know one ugly way to do it. Namely, make a variable for each
    possible combination of owner and surface. Then code an ordinary control
    break report. However, I am looking for something better.

    Hi Jenna_Fire,
    According to your description, you have a matrix contains total for each group on each level. Now your requirement is, when you click on any number (data field or total), it will go to the detail report which returns all the detail information of the people
    within the group scope. For example, if you click on the total of Active users in United States, it will return the detail information of Active users in New York and Texas. Right?
    In this scenario, we should set the parameter (@Country, @State, @City) allow multiple values in both main and detail report. And in Default Value (@Country, @State, @City), query out all distinct values. In the textbox which contains
    those total values, when set use these parameters to run the report, we only need to pass the parameters of parent groups. For example, if we click on the total of Active users in New York, we only need to pass Country, State, Status to detail report, and
    in the detail report, the City parameter will use all distinct values (Default Values) because we don't pass the City parameter. We have tested this case with sample data in our local environment. Here are steps and screenshots for your reference:
    1. Create parameter Country, State, City and Status in both main report and detail report. Set both Available Value and Default Value get values from query (Create a dataset for each parameter, use "select distinct [column] from [table]" as query). Set allow
    multiple values for parameter Country, State and City in both reports.
    2. In corresponding textbox, pass appropriate parameters in go to report Action.
    4. Filter data in detail report (in where clause or using filters).
    5. Save and preview. It looks like below:
    Reference:
    Using Parameters to Connect to Other Reports
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • SQL Query - The number of columns specified in "SQL Query" does not match t

    I am creating new UDM for tablespace alert, below is my query,however its failing with error
    SQL Query - The number of columns specified in "SQL Query" does not match the value specified in "SQL Query Output"
    I selected Metric type is number
    SQL Query Format : Two columns
    Query:
    SELECT d.tablespace_name,round(((a.bytes - NVL(f.bytes,0))*100/a.maxbytes),2)
    used_pct FROM sys.dba_tablespaces d,(select tablespace_name, sum(bytes) bytes, sum(greatest(maxbytes,bytes)) maxbytes from sys.dba_data_files group by tablespace_name) a,(select tablespace_name, sum(bytes) bytes from sys.dba_free_space group by tablespace_name) f
    WHERE d.tablespace_name = a.tablespace_name(+) AND d.tablespace_name = f.tablespace_name(+)
    AND NOT (d.extent_management = 'LOCAL' AND d.contents = 'TEMPORARY');
    Any clues why i am getting error.

    SQL> SELECT d.tablespace_name,round(((a.bytes - NVL(f.bytes,0))*100/a.maxbytes),2) used_pct
    2 FROM sys.dba_tablespaces d,(select tablespace_name, sum(bytes) bytes, sum(greatest(maxbytes,bytes)) maxbytes from sys.dba_data_files group by tablespace_name) a,(select tablespace_name, sum(bytes) bytes from sys.dba_free_space group by tablespace_name) f
    3 WHERE d.tablespace_name = a.tablespace_name(+) AND d.tablespace_name = f.tablespace_name(+)
    4 AND NOT (d.extent_management = 'LOCAL' AND d.contents = 'TEMPORARY');
    TABLESPACE_NAME USED_PCT
    MGMT_TABLESPACE .82
    SYSAUX 1.52
    UNDOTBS1 .32
    RMAN .02
    CORRUPT_TS 10.63
    USERS 0
    SYSTEM 2.26
    MGMT_ECM_DEPOT_TS .04
    MGMT_AD4J_TS 0

  • How to get the difference between two columns in a column group

    Hi All,
    My first time here and really new to programming. I would like to get the difference between 2 columns that are inside 
    a column group.
    Here is my sample table below: The Column Group is PeriodNumber and can only choose 2. like 1 and 2.. I would like to have a third row which will simply calculate the difference between the amounts in PeriodNumber 1 and 2.
                                PeriodNumber          
    Account                    1                            2     
    1) Cash                10,000                15,000
    2) Receivables      12,000                11,500
    3) Equipment          5,000                  5,500
    Total Assets          27,000                32,000

    Hi yabgestopa,
    From your description, you want to get the difference between two columns in a column group. After testing it in my environment, we can use custom code to achieve your requirement. For more details, you can refer to the following steps:
    Copy the custom code below and paste it to your report. (Right-click report>Report Properties>Code)
    Dim Shared Num1 As Integer
    Dim shared Num2 As Integer
    Public Function GetAmount(Amount as Integer, Type as String)
    If Type = "1" Then
    Num1=Amount
    Else
    Num2=Amount
    End If
    Return Amount
    End Function
    Public Function GetDif()
    Return Num1-Num2
    End function
    Right-click the second column to insert a third column with Outside Group-Right.
    Then use the expressions below in the matrix.
    =Code.GetAmount(Fields!Amount.Value,Fields!PeriodNumber.Value)
    =code.GetAmount(Sum(Fields!Amount.Value),Fields!PeriodNumber.Value)
    =Code.GetDif()
    The report looks like below.
    If you have any questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Alternate column colors in SQL 2008 Matrix

    I have a Matrix with dynamic columns. I am grouping Matrix on one column group. I am trying to have a different color for every group. I hvae so far, three groups. How can I do that? A note, there is no data for every column group in every row.

    Hi,
    Please try the below
    1. Go the reports code window (Menu Report--> Report Properties--> code tab) and paste the below to create the function getGroupCounter
    dim Counter as integer=0
    public function getGroupCounter() as Integer
    Counter=Counter+1
    return Counter
    end function
    2. Go to the properties of the column group (Right click the column group and select group properties)
    3. Click the variables tab on the left
    4. Click on Add and set Name as GroupCountValue and set the expression (in the expression window) as =Code.getGroupCounter
       This expression sets the group variable to hold its running count value.
    5. Click OK
    6. Now in the matrix, click the column handle (that selects the whole column) for the column group, in properties window, set the below expression for background color
    =iif(Variables!GroupCountValue.Value mod 2 =0,"yellow","green")
    This would display the alternate colors green and yellow for the columns
    If you need to display different colors for each column, ten use the switch function, as shown below
    =switch(Variables!GroupCountValue.Value=1, "yellow",Variables!GroupCountValue.Value=2,"green",Variables!GroupCountValue.Value=3,"red")
    7. Run the report and observe the result.
    Hope this helps. Feel free to discuss if you need any further help.
    Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.
    BH

  • SSRS Matrix not showing all the entry for a Column Groups

    I created a Matrix in my SSRS report and for some reason if the COLUMN GROUP has more than one
    entry it only shows the first one and not the second or consequent entries.
    I opened a question in SO and here is the link:
    http://stackoverflow.com/questions/23248421/how-to-add-column-in-a-ssrs-table-based-on-criteria
    All help is appreciated.

    Hi SiKni8,
    According to your description, you have a matrix report. If a user has more than one start date and end date, you want to put all those start dates and end dates into one single row for this user. Right?
    In Reporting Service, for all data fields textbox appearing at intersection of rows and columns, the matrix will use Sum aggregation function by default. If the data can’t be calculated by aggregation function, it will return the first one of records. This
    is the reason why you only get the first start date and end date for each user. In your scenario, it is impossible to append more columns at the end of the matrix without setting column group. And we can never append columns dynamically based on the numbers
    of the records. So for your requirement, we find a workaround which we think is the most related to the answer you want. We use custom code to get both StartDate and EndDate, then return them as string. After that we append those strings and put the whole
    string into a cell. Your case has been tested in our local environment. Here are steps and screenshots for your reference:
    Put the custom code below into your report:
    Dim Num As String = ""
    Dim tempstr As String = ""
    Function AggregateString(Title as String, StartDate as String, EndDate as String) 
    If Title = Num Then
       tempstr = tempstr + "(" +StartDate+" , "+EndDate+")  "
    Else
      tempstr=""
      Num = Title
      tempstr =tempstr+"("+StartDate+" , "+EndDate+")  "
    End If 
    Return tempStr 
    End Function
    In our sample report, we created a matrix based on your description. It looks like below:
    In textbox next to [Title], put the expression below into it:
    =runningvalue(Code.AggregateString(Fields!Title.Value,Fields!StartDate.Value,Fields!EndDate.Value),Last,"Title")
    Ps: In our report, we set the type of date as string when creating table and dataset. If your date type is different, use Cstr() function and convert it into string.
    Save and preview. The result looks like below:
    Reference:
    Matrices (Report Builder and SSRS)
    RunningValue Function (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • Column Grouping By Month

    Hello. Here's my data set:
    I'm trying to produce a Reporting Services report that displays counts by month -- but for both calls open and closed under a single month heading. For example:
    I don't see a straightforward way to do this. I'm using a Tablix in SSRS 2008 R2. I can easily group counts by months if I'm working with just one column (just the open or closed date), but this isn't so clean. I appreciate any ideas. Thank you.

    Hi Bvy,
    I have tested on my local environment and you can modify the query in the dataset to count the open and closed for each month and then design the report, finally we will get the same structure as the snapshot you have provided.
    Details information below for your reference:
    1. Modify the query in the main dataset like below:
    ;with cte as
    select CallCategory,DATEPART(month,DateOpen) DateOpen,DATEPART(month,DateClose) DateClose from [TableName]
    cte2 as
    select sum(case when c.DateOpen is null then 0 else 1 end) cn,t.callcategory,t.dateopen from cte c right join (select * from (select distinct dateopen from cte) a cross join (select distinct callcategory from cte) as t) t
    on c.dateopen=t.dateopen and c.callCategory=t.callcategory group by t.CallCategory,t.DateOpen
    cte3 as (
    select sum(case when c.DateClose is null then 0 else 1 end) cn,t.callcategory,t.dateClose from cte c right join (select * from (select distinct dateClose from cte) a cross join (select distinct callcategory from cte) as t) t
    on c.dateClose=t.dateClose and c.callCategory=t.callcategory group by t.CallCategory,t.dateClose
    select c.callcategory,c.cn as [open], isnull(t.cn,0) as [close],isnull(c.DateOpen,t.DateClose) as month from cte2 c full join cte3 t on c.CallCategory=t.CallCategory and c.DateOpen=t.DateClose
    2. Design the Report structure using the Matrix instead of the tablix like below:
    Row Group:Call_Category
    Column Group:Month
    3. Preview you will get the result like below:
    If you still have any problem, please feel free to ask.
    Regards
    Vicky Liu
    If you have any feedback on our support, please click
    here.
    Vicky Liu
    TechNet Community Support

Maybe you are looking for

  • JSP's running under Resin server engine???

    I have a JSP application that I am trying to move from running under Tomcat 4.0 to Resin web server engine. When trying to run the application, I get this error: java.util.MissingResourceException: Can't find bundle for base name AppProperties, local

  • Adobe Photoshop Elements 10 wont activate on my 2nd computer.

    I had the Adobe Photoshop Elements 10 on my 2nd computer but after getting a virus on my computer and resetting everything on it, the program will not activate on my 2nd computer again.

  • Configs don't exist?

    After the reboot in install my internet isn't working, so I decide to go and look through my config files again.  So I type after I log in as root: sudo nano /ect/rc.conf and it can't find it (new file button). So I try to do some digging with the ls

  • IMAP users continually prompted for password when switching folders

    I've sifted through /var/log/mailaccess.log and I notice the following message is logged when the above behavior occurs: Jan 19 00:59:49 hostname imap[3879]: badlogin: [XXX.XXX.XXX.XXX] GSSAPI [SASL(-13): authentication failure: user username is not

  • OS X Tiger Install Help

    I currently am running OS 9 on a PowerPC G4. It has 400 MHz, 19 GB, and 512 memory. I am trying to install OS X Tiger. The computer sees the disc when I insert it. When I click on the "restart" button that it shows me an error occurs and says it can