Only year field in ssrs report

Warsi, MD Arshad 1 Reputation point
2021-12-23T16:38:34.97+00:00

I have created one report using xml I have one date parameter called 'X' while selecting date parameter it is showing year months and date but I want only date could you please help me ?
160193-image.png

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.
3,066 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Joyzhao-MSFT 15,636 Reputation points
    2021-12-24T02:49:09.777+00:00

    Hi @Warsi, MD Arshad ,
    If you only want any part of the date/time, you will not be able to use the calendar table.
    Do you only need the "Day" part of the date you want? For example, for the date "12/23/2021", you only need the value "23". If this is the case, you need to create another Dataset to assign values to the parameters. Use the following statement to create a Dataset:

    SELECT DISTINCT DATEPART(day, YourDateField) AS OnlyDate  
    FROM YourTableName  
    

    Select "Get Value from a query" in the "Available Values" of the parameter property, and select the "OnlyDate" field in the Dataset.

    If you want the date part of the date/time, you can use an expression to change the date format: =Format(Fields!YourDateColumn.Value,"dd/MM/yyyy")

    If I misunderstood what your mean, please feel free to correct me.

    Note: No matter what format your parameter is set to, if your parameter is used to view the report, please make sure that your report has the same field value as the parameter.

    Best Regards,
    Joy


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    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.


  2. Warsi, MD Arshad 1 Reputation point
    2021-12-24T03:02:39.647+00:00

    Hi @Joyzhao-MSFT

    I am very new in ssrs report. I have one requirement to create the annual report based on the fetch xml query(I am taking fetch xml query from advance find and creating more than two datasets) and i have create a date parameter "dateOnly" but dateOnly parameter is having by default year/month/day but I want to customize only year and report will be showed once i click only particular years(let's assume if I have only 2021 year data only those data will be appeared in report and if i select 2020 year then no data will be showed in ssrs report). Please help me

    Note: I am using fetch xml but I haven't write anything on date parameter.

    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.