Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7544461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:40:40+00:00 2026-05-30T08:40:40+00:00

I have a dataset that is going to get passed to an SSRS report

  • 0

I have a dataset that is going to get passed to an SSRS report that looks like this:

CODE TEXT COUNT  MONTH 
100  ABC  20     January 
100  ABC  10     February
200  DEF  15     January 
200  DEF  15     February
300  GHI  0      x 
400  JKL  10     January

This ‘x’ indicates there is no data for that code/text for the current year, however, I still need it to display. In SSRS I want to have a column to display for the current month (February) and a column to display for year to date:

    CODE TEXT MONTH_TO_DATE YEAR_TO_DATE
    100  ABC  10            30   [20 + 10]
    200  DEF  15            30   [15 + 15]
    300  GHI  0             0    [0] 
    400  JKL  0             10   [0 + 10] 

Is this possible in SSRS 2008?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T08:40:41+00:00Added an answer on May 30, 2026 at 8:40 am

    This is going to have to be done in SQL so it would be easier to adjust the SQL if you posted what you have already, rather than the data resulting from that SQL.

    Anyway, we have to find a way to know it is the current month and display it, which we can do with the SQL CASE statement. Maybe you have a date field you can query which might be cleaner than below, but I’ll just run with the data as you have provided (that is, we just have a month name which we compare to the current month using the DATENAME and GETDATE SQL functions – obviously this doesn’t work if you have multiple years of data as every February will be aggregated into the current month, but you get the idea for what to do):

    SELECT [CODE], [TEXT], 
        SUM(CASE WHEN [MONTH] = DateName(month, GetDate()) THEN [COUNT] END) AS CurrentMonth,
        SUM([COUNT]) AS YearToDate
    FROM MyTable
    GROUP BY [CODE], [TEXT]
    ORDER BY [CODE], [TEXT]
    

    Now, in your comment on Vlad’s answer you say you can’t do a SUM(COUNT(fieldname)) which you can actually do if you use nested queries, like so:

    SELECT [CODE], [TEXT], SUM([COUNT]) AS Total
    FROM ( -- This is a nested query
        SELECT [CODE], [TEXT], COUNT(somefield) AS [COUNT]
        FROM MyTable
    )
    GROUP BY [CODE], [TEXT]
    ORDER BY [CODE], [TEXT]
    

    If you want to display x for the zero values then use the following Format for the YearToDate cell:

    #,##0;-#,##0;x
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a (dense) dataset that consist of 5 groups, so my data.frame looks
I have this Birt report that I inherited from another developer, consisting of a
I have a dataset that i am trying to set the default value as
I have a dataset that returns questions and answers from the database, each answer
I have a large dataset that load in with a fill method on page
I have a large dataset that I am dealing with in Python. It is
Imagine you have a large dataset that may or may not be filtered by
I have a DataSet with some DataTables that are linked together with DataRelations (classic
I have a dataset of 1 minute data of 1000 stocks since 1998, that
I have a datagrid that is filled with a dataset from an SQL query.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.