Ssrs expression invalid swtich case

I am unable to execute the below expression.. error when i see the report preview as
The defenition of the report is invalid
The value expression for the text box'Text Box1' has a nested aggregate that specifies a dataset scope.Inner aggregates cannot specify a dataset scope.
My Expression is
= "Record contains "
+ Switch(
Sum(Fields!FQ.Value, "ds") <> 0 and Sum(Sum(Fields!QC.Value, "ds") + Sum(Fields!QA.Value, "ds") )<> 0 , "Fit and Auto",
Sum(Fields!FQ.Value, "ds") <> 0 and Sum(Sum(Fields!QC.Value, "ds") + Sum(Fields!QA.Value, "ds") )= 0 , "Fit",
Sum(Fields!FQ.Value, "ds") = 0 and Sum(Sum(Fields!QC.Value, "ds") + Sum(Fields!QA.Value, "ds") ) <> 0 , "Auto"
ShanmugaRaj

Hi ShanmugaRaj,
After taking a simple test in my local environment, I can reproduce this issue. Based on my research, the issue is caused by the expression “Sum(Sum(Fields!QC.Value, "ds") + Sum(Fields!QA.Value, "ds") )“. Just as the error message shown, inner aggregates
cannot specify a dataset scope.
If I understand correctly, you just want to use the expression to calculate the value of Sum(Fields!QC.Value, "ds")  plus Sum(Fields!QA.Value, "ds"). If in this case, we can directly use the expression below to achieve your requirement:
(Sum(Fields!QC.Value, "ds") + Sum(Fields!QA.Value, "ds"))
So the complete expression is like below:
= "Record contains  " + Switch( Sum(Fields!FQ.Value, "ds") <> 0 and (Sum(Fields!QC.Value, "ds") + Sum(Fields!QA.Value, "ds")) <> 0 , "Fit and Auto",Sum(Fields!FQ.Value, "ds") <> 0 and (Sum(Fields!QC.Value, "ds") + Sum(Fields!QA.Value,
"ds") )= 0 , "Fit",Sum(Fields!FQ.Value, "ds") =  0 and (Sum(Fields!QC.Value, "ds") + Sum(Fields!QA.Value, "ds") ) <>  0 , "Auto")
If there are any misunderstanding, please elaborate the issue for further investigation.
Thanks,
Katherine Xiong
If you have any feedback on our support, please click
here.
Katherine Xiong
TechNet Community Support

Similar Messages

  • How Get last five quarters data using ssrs expression

    Hi All,
    i have an ssrs report where i have to get last five quarters data  and also last five months data when i select quarterly/monthly parameter.....
    is there any possibilty that we can get this using ssrs expression
    any help please.........

    Hi Mr.SMK,
    According to your description, there is an SSRS report, you want to create a parameter, when you select quarterly, data of last five quarters will be displayed. If you select monthly, data of last five months will be displayed. If that is the case, please
    refer to the following steps:
      1. In design surface, in Report Data pane, right-click Parameters and click Add Parameter.
      2. Type parameter name and prompt, set Data Type to Date/Time.
      3. Click Available Values in left pane, select Specify values.
      4. Click Add button, in Label text box, type Quarterly, then click (fx) button and type the expression like below:
    =DateAdd("q",-5,Today())
      5. Click Add button, in Label text box, type Monthly, then click (fx) button and type the expression like below:
    =DateAdd("m",-5,Today())
      6. Right-click the dataset used to retrieve data for the report and open Dataset Properties dialog box.
      7. Click Filters in left pane, click Add button, select Data from Expression drop down list, set Operator to >=, in Value text box, type [@ParameterName].
    The following screenshots are for your reference:
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    Wendy Fu
    TechNet Community Support

  • Pass function name as parameter in SSRS expression

    I have a function (GetColumnFieldName) which returns string datatype
    Now I want to use this function in below SSRS expression
    =Code.GetDisplay("FirstName",Parameters!SelectedCols.Value,Parameters!DisplayCols.Value)
    At the above expression I want to replace "FirstName" with  function GetColumnFieldName which returns the same "FirstName".
    Please suggest.

    Hi Jajatibabu,
    If I understand correctly, you want to use GetColumnFieldName function which returns a field name to replace the “FirstName” in the expression you post.
    If in this scenario, we can directly use Code.GetColumnFieldName(parameters) to replace the “FirstName” like below:
    =Code.GetDisplay(Code.GetColumnFieldName(parameters),Parameters!SelectedCols.Value,Parameters!DisplayCols.Value)
    Note that we should type the correct parameters in the GetColumnFieldName function.
    If there are any misunderstanding, please elaborate the issue for further investigation.
    Thanks,
    Katherine Xiong
    If you have any feedback on our support, please click
    here.
    Katherine Xiong
    TechNet Community Support

  • SSRS Expression help

    Hello,
    Is there anyway to default to the first day of the month in a SSRS expression.  I'm looking to do the reverse of the EOMONTH() function.
    The date value is coming from a parameter @BegDate and formatted YYYY-MM-DD.  So if the parameter is set to 2015-08-31 it would show 2015-08-01
    Any information would be greatly appreciated.
    x

    I ended up using the following:
    DateSerial(Year(Parameters!BegDate.Value), Month(Parameters!BegDate.Value), 1
    x

  • SSRS expression for today,yesterday,Lastweek ,Last fortnight,Last Month, Year to date

    Hi All;
    I have a field called createdon 
    Using this field i need to create the SSRS expression for the table as below 
    Any help much appreciated
    Thanks
    Pradnya07

    use expressions as below
    assuming this is to be done in SSRS
    Today
    =COUNT(IIF(
    DateDiff(DateInterval.Day,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Day,Cdate("01/01/1900"),Now()),Fields!YourRequiredField.Value,Nothing))
    Yesterday
    =COUNT(IIF(
    DateDiff(DateInterval.Day,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Day,Cdate("01/01/1900"),Now())-1,Fields!YourRequiredField.Value,Nothing))
    LastWeek
    =COUNT(IIF(
    DateDiff(DateInterval.Week,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Week,Cdate("01/01/1900"),Now())-1,Fields!YourRequiredField.Value,Nothing))
    Last fortnight
    =COUNT(IIF(
    (DateDiff(DateInterval.Week,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Week,Cdate("01/01/1900"),Now())-1)
    Or (DateDiff(DateInterval.Week,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Week,Cdate("01/01/1900"),Now())-2),Fields!YourRequiredField.Value,Nothing))
    Last Month
    =COUNT(IIF(DateDiff(DateInterval.Month,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Month,Cdate("01/01/1900"),Now())-1,Fields!YourRequiredField.Value,Nothing))
    Year To Date
    =COUNT(IIF(DateDiff(DateInterval.Year,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Year,Cdate("01/01/1900"),Now())
    And
    DateDiff(DateInterval.Day,Cdate("01/01/1900"),Fields!createdon.Value) <= DateDiff(DateInterval.Day,Cdate("01/01/1900"),Now()),Fields!YourRequiredField.Value,Nothing))
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • SSRS Expression for Conditional Filtering using the "IN" operator

    Hello,
    I need to filter my dataset based on a parameter:
    If Period= 1 then Week must be in (W1, W2, W3),  Else Week must be in (W10, W20, W30)
    I tried using the "IN" operator but don't know how to create the expression for the "Value" field. I tried the following:
    iif(Parameters!Period.Value = 1,
    "W1, W2, W3",
    "W10, W20, W30")
    But it doesn't work.
    Expression: Week
    Operator: IN
    Value: ???
    Any help would be highly appreciated!

    Hi,
    Use split function.
    See this expression: IIF(Parameters!Period.Value = 1, SPLIT("W1,W2,W3",","), SPLIT("W10,W20,W30",","))
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/8da78c9b-7f0c-42f1-a9c4-82f065f317c9/using-the-in-operator-in-ssrs-expressions
    Thanks Shiven:) If Answer is Helpful, Please Vote

  • SSRS expression for division

    Hi All,
    Below is the my table with SSRS expressions marked as A and B 
    Expression A gets the serial number 1, 2, 3 etc
    I need to get expression A/B
    Any help on this much appreciated
    Thanks 
    Pradnya07

    It's look like you want B/A, not A/B.
    You can try couple things. If you are allowed to use ReportItems and refer to the textbox value, then simply use this:
    =ReportItems!textboxnameforB.Value / ReportItems!textboxnameforA.Value
    If that gives you error as far as not allow to use ReportItems, then try create a divide function in custom code and then pass the value to it.
    Public Function Divide(Num1 as double, Num2 as double) AS double
        IF IsNothing(Num1) Or  IsNothing(Num2) Or Num1 = 0 Or Num2 = 0 Then
            Divide = 0
        ELSE
            Divide = Num1  / Num2
        END IF
    End Function
    Then, simply use this in the textbox you want the value:
    =code.Divide(RunningValue(Fields!new_programmeoutputid.Value,CoutDistinct, "new_outputs"),RunningValue(Fields!new_claimmonthid.Value,CountDistinct,
    Nothing))
    If that still does not work, then try to bring these values in the query itself.
    good luck.

  • SSRS Expression with OR

    Hi, 
    Can anyone tell me how to use OR in an SSRS expression?
    I would like to set the BorderStyle Left (& Right) property to "None" for two rows so I need to
    use an OR (6 or 9)  
    This is what I have so far:
    =IIf(RowNumber(nothing)=6,"None","Default") 

    Hi,
    Try Below,
    =Switch(RowNumber(nothing)=6 ,"None",RowNumber(nothing)=9,"None")
    OR
    =IIf(RowNumber(nothing)=6 OR RowNumber(nothing)=9,"None","Default")
    OR
    =IIf(RowNumber(nothing)=6,"NONE",IIf(RowNumber(nothing)=9,"NONE","Default"))
    Thanks

  • Ssrs expression to sql query

    Hi,
    I am unable to convert the below ssrs expression to sql query. can you guys help.
    --          IIF(Parameters!parameter1.Value Is Nothing, 
    --               " 3>2 ", 
    --               "column1 NOT LIKE
    --                           Replace(IIF(Left(Parameters!parameter1.Value, 1) = "'", 
    --                                             Parameters!parameter1.Value, 
    --                                             "'" & Replace(Parameters!parameter1.Value, "'", "''")  "'"),
    Thanks.

    Thank you for your response Carnegie,
    I actually have two stored procedures as below. (columns and joined tables are excluded)
    I need to change the dates of @DateFrom and @DateTo parameter, I am passing @DateFrom_FD and @DateTo_LD as well.
    CREATE ROCEDURE [dbo].[Test]
    (@DateFrom
    SMALLDATETIME
      , @DateTo
    SMALLDATETIME
      , @program
    VARCHAR(MAX))
    AS
    DECLARE
    @DateFrom_FD
    SMALLDATETIME
           , @DateTo_LD
    SMALLDATETIME
    SET @DateFrom_FD = DATEADD(MONTH,DATEDIFF(MONTH,0,@DateFrom),0)
    SET @DateTo_LD = DATEADD(DAY,-1,DATEADD(MONTH,DATEDIFF(MONTH,0,@DateTo)+1,0)) 
    SELECT 
      DimDate.[Year]
    , DimDate.[Month]
    , DimDate.PK_Date
    , CustomerID
    FROM DimDate
    WHERE DimDate.PK_Date BETWEEN @DateFrom_FD AND @DateTo_LD
    Now I am using one of the SP as a main report and the other SP as a subreport.
    In order to configure the main report and the subreport, I believe that I need to link them with parameters.
    However, in the parameters of subreport properties, the option given are only @DateFrom and @DateTo.
    No @DateFrom_FD AND @DateTo_LD
    Therefore, I am thinking to use expressions to convert @DateFrom and @DateTo the same way I did in SQL.
    I am not sure if this works....but this is the only thing that I could think of.
    Thank you,
    YJB5151

  • SSRS Expression to calculate percentage with the denominator being the first value in the same column group in a matrix report

    Hello, Expert,
    Could you please help me with the following problem? Thanks in advance!
    I have designed the matrix report (SSRS 2012) with database table structure looks like below.    
    Week           
    Version
         Count
    Week1
    V1.1
    4000
    Week1
    V1.2
    4000
    Week1
    V1.3
    4000
    Week2
    V1.1
    3000
    Week2
    V1.2
    3000
    Week2
    V1.3
    3000
    Week3
    V1.1
    2000
    Week3
    V1.2
    2000
    Week3
    V1.3
    2000
    Week4
    V1.1
    1000
    Week4
    V1.2
    1000
    Week4
    V1.3
    1000
    The matrix report displays like below. Column grows based on no of Week in the table.   
    Week1
    Week2
    Week3
    Week4
    V1.1
    4000
    3000
    2000
    1000
    V1.2
    4000
    3000
    2000
    1000
    V1.3
    4000
    3000
    2000
    1000
    What I want to do now is: instead of the Count values, I need to calculate the percentage of each week over the
    Count in Week1 so that each cell displays Count(Week2)/Count(Week1), Count(Week3)/Count(Week1), etc. What is the SSRS expression for that? I’m new to SSRS, Please help!

    Heidi,
    Thank you so much for your reply and solution! Now I know how to get the first field in a group. But I can't apply your solution directly just yet because in order to explain my problem I simplified my data structure. My real data structure has a nested
    group like this:
    Week  VersionMajor VersionMinor Count
    Week1  V1           V1.1         2000
    Week2  V1           V1.1         1500
    Week3  V1           V1.1         800
    Week1  V1           V1.2         1000
    Week2  V1           V1.2         500
    Week3  V1           V1.2         200
    Week1  V1           V1.1         2000
    Week2  V1           V1.1         1500
    Week3  V1           V1.1         800
    Week1  V1           V1.2         1000
    Week2  V1           V1.2         500
    Week3  V1           V1.2         200
    Here is the query for the above data:
    SELECT 'Week1' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 2000 AS Count
    UNION ALL
    SELECT 'Week2' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 1500 AS Count
    UNION ALL
    SELECT 'Week3' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 800 AS Count
    UNION ALL
    SELECT 'Week1' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 1000 AS Count
    UNION ALL
    SELECT 'Week2' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 500 AS Count
    UNION ALL
    SELECT 'Week3' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 200 AS Count
    UNION ALL
    SELECT 'Week1' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 2000 AS Count
    UNION ALL
    SELECT 'Week2' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 1500 AS Count
    UNION ALL
    SELECT 'Week3' AS Week, 'V1' AS VersionMajor, 'V1.1' AS VersionMinor, 800 AS Count
    UNION ALL
    SELECT 'Week1' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 1000 AS Count
    UNION ALL
    SELECT 'Week2' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 500 AS Count
    UNION ALL
    SELECT 'Week3' AS Week, 'V1' AS VersionMajor, 'V1.2' AS VersionMinor, 200 AS Count
    And my matrix table looks like this:
    What I need to do is to calculate the percentage of each week over week1 for
    1) V1 Total
    2) V1.1
    3) V1.2
    I can't use your solution directly because I need to apply Sum function for each cell and the Sum function gives me error when I try to use it on the denominator
    First(Fields!Count.Value,"VersionMinor"). If you could help me further to get to the final solution, I'd really appreciate it!!
    Happy New Year!

  • SSRS expression for grouping minutes

    Hi All,
    Can you please help me to write an SSRS expression to group minutes
    =SWITCH(
    Fields!TotalHours.Value = 0
    and  240,
    "0 To 4 hrs",
    Fields!TotalHours.Value = 241
    and480,
    "5 To 8 hrs",
    Fields!TotalHours.Value = 481
    and720,
    "9 To 12 hrs",
    Fields!TotalHours.Value = 721
    and960 ,
    "13 To 16 hrs",
    Fields!TotalHours.Value = 961
    and1200,
    "17 To 20 hrs",
    Fields!TotalHours.Value = 1201
    and12000000,
    "More than 20 hrs"
    Any help much appreciated
    Thanks
    Pradnya07

    Try this...
    = SWITCH ( Fields!TotalHours.Value <= 240, "0 to 4 Hrs",
    Fields!TotalHours.Value <= 480, "5 to 8 Hrs",
    Fields!TotalHours.Value <= 720, "9 to 12 Hrs",
    Fields!TotalHours.Value <= 960, "13 to 16 Hrs",
    Fields!TotalHours.Value <= 1200, "17 to 20 Hrs",
    Fields!TotalHours.Value > 1200, "More than 20 Hrs")

  • Issue with SSRS Expression

    Hi all, 
    I am facing some issue with ssrs expression. 
    I used below expression to show sum of budget. 
    =Sum(  CDbl(Fields!Budget.Value))
    When I preview the report it shows #Error in that textbox. 
    Please help me to fix this one , I am not getting where its breaking.. 
    Thanks
    Rohit

    Hi Rohit,
    According to your description, you want to sum the [EstimatedCostField] with an expression.
    In your scenario, since the [EstimatedCostField] is budget which you want to perform sum calculation, you should specify the sum expression like below:
    =Sum(CDbl(Fields!EstimatedCostField.Value))
    If issue persists, please run the report in the BIDS then check the warning message in output to see the detail information about the #Error. Besides, please also share the report design for our analysis.
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • Regular Expression Search for Case Statement in VBA

    Hi,
    I'm having trouble trying to use regular expressions in a case statement. I have a CSV spreadsheet of a server's netstat output and am trying to plot everything into Visio. I have been able to do that, however I'm not trying to expand this capability and
    resuse the same code for many different servers. 
    I have the mainServer variable set as a Variant and in my current example it is set as "INTPXY001" (internal proxy server 001). I have tried different regex statements for the potential to have INTPXY001 - INTPXY999, EXTPXY001 - EXTPXY999, and
    SVCPXY001 - SVCPXY999 in place of the Case "INTPXY001", but nothing I have tried seems to work.
    '========================================
    Set mainServer As Variant
    Set AppVisio = CreateObject("visio.application")
    AppVisio.Visible = True
    AppVisio.Documents.AddEx "", visMSDefault, 0
    AppVisio.Documents.OpenEx "server_u.vss", visOpenRO + visOpenDocked
    mainServer = ActiveSheet.Cells(1, 2) 'sets mainServer to INTPXY001
    With AppVisio.ActiveWindow.Page
    Select Case mainServer
    Case "INTPXY001"
    .Drop AppVisio.Documents.Item("SERVER_U.VSS").Masters.ItemU("Proxy server"), 2.25, 9.25
    Case Else
    .Drop AppVisio.Documents.Item("SERVER_U.VSS").Masters.Item(("Server"), 2.25, 9.25
    End Select
    End With
    '========================================

    You cannot declare variables As Variant in VBScript. All variables in VBScript are implicitly variants.
    If you are asking about VBA (Visual Basic for Applications), then you're not asking in the correct forum.
    -- Bill Stewart [Bill_Stewart]

  • Missing Expression Error When Case Statment is used as field

    I have tried to write an expression that will calculate how many days ago a request was submitted and return a user defined value if the calculation falls within the criteria in the case statment. The SQL View for the Query I am using is shown below:
    SELECT A.F_POSN_REQUEST_ID, A.F_REQ_ECP_STATUS, TO_CHAR(A.REQUEST_DTTM,'YYYY-MM-DD-HH24.MI.SS."000000"'), TO_CHAR(A.F_REQ_ST_DT,'YYYY-MM-DD-HH24.MI.SS."000000"'), TO_CHAR(A.F_REQ_ECP_ST_DT,'YYYY-MM-DD-HH24.MI.SS."000000"'), TO_CHAR(A.F_REQ_ECP_PROC_DT,'YYYY-MM-DD-HH24.MI.SS."000000"'), CASE WHEN(sysdate - TO_DATE(SUBSTR( TO_CHAR(A.F_REQ_ST_DT,'YYYY-MM-DD-HH24.MI.SS."000000"'),1,16),'YYYY-MM-DD-HH24.MI'))>60 THEN '>60' ELSE(CASE WHEN(sysdate - TO_DATE(SUBSTR( TO_CHAR(A.F_REQ_ST_DT,'YYYY-MM-DD-HH24.MI.SS."000000"'),1,16),'YYYY-MM-DD-HH24.MI')) >30 AND <=60 THEN '30 - 60' ELSE(CASE WHEN(sysdate - TO_DATE(SUBSTR( TO_CHAR(A.F_REQ_ST_DT,'YYYY-MM-DD-HH24.MI.SS."000000"'),1,16),'YYYY-MM-DD-HH24.MI'))>=15 AND <=30 THEN '15 - 30' ELSE(CASE WHEN(sysdate - TO_DATE(SUBSTR( TO_CHAR(A.F_REQ_ST_DT,'YYYY-MM-DD-HH24.MI.SS."000000"'),1,16),'YYYY-MM-DD-HH24.MI'))<15 THEN 'Less Than 15' ELSE NULL END)END)END)END))
      FROM PS_F_POSN_REQUEST A
      WHERE A.F_REQ_ECP_STATUS IN ('I','O','P')
      GROUP BY  A.F_POSN_REQUEST_ID,  A.F_REQ_ECP_STATUS,  TO_CHAR(A.REQUEST_DTTM,'YYYY-MM-DD-HH24.MI.SS."000000"'),  TO_CHAR(A.F_REQ_ST_DT,'YYYY-MM-DD-HH24.MI.SS."000000"'),  TO_CHAR(A.F_REQ_ECP_ST_DT,'YYYY-MM-DD-HH24.MI.SS."000000"'),  TO_CHAR(A.F_REQ_ECP_PROC_DT,'YYYY-MM-DD-HH24.MI.SS."000000"')When I try to run the query I get Message=ORA-00936: missing expression (50,380)
    Any suggestions you could provide to help me clear this error would be greatly appreciated.
    Edited by: 992737 on Mar 8, 2013 9:07 AM

    Hi,
    Welcome to the forum!
    I think you want something like this:
    CASE
        WHEN  a.f_req_st_dt < TRUNC (SYSDATE) - 60  THEN  '>60'
        WHEN  a.f_req_st_dt < TRUNC (SYSDATE) - 30  THEN  '30.1-60'
        WHEN  a.f_req_st_dt < TRUNC (SYSDATE) - 15  THEN  '15.1-30'
        WHEN  a.f_req_st_dt < TRUNC (SYSDATE)       THEN  '15 or less'
    ENDNested CASE expressions aren't needed very much. Each WHEN clause is evaluated only if all the ealier ones have failed. For example, when testing to see if a row is in the 301.-60 range above (that is, the 2nd WHEN clause), there's no need to see if the difference is greater than or equal to 60; it wouldn't be evaluating that clause if the 1st WHEN condition was TRUE.
    This assumes that a.f_req_st_dt is a TIMESTAMP or DATE; either datatype can be compared with DATEs, such as SYSDATE-60, so there's no need to conevert them to strings, and then convert them back into DATEs.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Simplify the problem as much as possible. Show only the parts that you don't already know how to do.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}
    Never write, let alone post, unformatted code. Indent the code to show the exent and structure of clauses (SELECT, FROM, etc.), and complex expressions (such as CASE). The forum FAQ explains how to use \ tags when posting formatted text on this site.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • SQL Query to SSRS Expression

    How can I convert the below two queries in SQL to SSRS expression?
    1) DATEADD(MONTH,DATEDIFF(MONTH,0,@DateFrom),0)
    2) DATEADD(DAY,-1,DATEADD(MONTH,DATEDIFF(MONTH,0,@DateTo)+1,0)) 
    Thank you,

    Thank you for your response Carnegie,
    I actually have two stored procedures as below. (columns and joined tables are excluded)
    I need to change the dates of @DateFrom and @DateTo parameter, I am passing @DateFrom_FD and @DateTo_LD as well.
    CREATE ROCEDURE [dbo].[Test]
    (@DateFrom
    SMALLDATETIME
      , @DateTo
    SMALLDATETIME
      , @program
    VARCHAR(MAX))
    AS
    DECLARE
    @DateFrom_FD
    SMALLDATETIME
           , @DateTo_LD
    SMALLDATETIME
    SET @DateFrom_FD = DATEADD(MONTH,DATEDIFF(MONTH,0,@DateFrom),0)
    SET @DateTo_LD = DATEADD(DAY,-1,DATEADD(MONTH,DATEDIFF(MONTH,0,@DateTo)+1,0)) 
    SELECT 
      DimDate.[Year]
    , DimDate.[Month]
    , DimDate.PK_Date
    , CustomerID
    FROM DimDate
    WHERE DimDate.PK_Date BETWEEN @DateFrom_FD AND @DateTo_LD
    Now I am using one of the SP as a main report and the other SP as a subreport.
    In order to configure the main report and the subreport, I believe that I need to link them with parameters.
    However, in the parameters of subreport properties, the option given are only @DateFrom and @DateTo.
    No @DateFrom_FD AND @DateTo_LD
    Therefore, I am thinking to use expressions to convert @DateFrom and @DateTo the same way I did in SQL.
    I am not sure if this works....but this is the only thing that I could think of.
    Thank you,
    YJB5151

Maybe you are looking for

  • Backup error on DEV  (Permission denied)

    Dear all, Pls check the backup log... 10:49:03     Job started 10:49:03     Step 001 started (program RSDBAJOB, variant &0000000000222, user ID S2K_SATHIES) 10:49:04     Execute logical command BRBACKUP On host SAPDEVQA 10:49:04     Parameters:-u / -

  • ...cannot be updated. The required file cannot be found.

    I just got my 2gig iPod nano for Christmas and it works fine, i uploaded like 109 songs on it aleady and a few photos. I only connected it to my computer like twice but now when i tried to add a few more songs to it from iTunes an error occurs with a

  • IPad and iPhone not working with a monitor

    I tried to get my iPad and iPhone to play Netflix on a Acer 20inch monitor.  It started to work than stopped. I got a message that the display connected display is not sponsored. It there a download that is available to have my monitor display video.

  • Screen Protector for the TM2

    Anyone know of a good screen protector for the TM2 that doesn hinder the touch screen? I have done a search but nothing comes up. Maybe its just too new for now. Will a TX2 screen protector fit? I don't have a TX2 so I can't compare the screen sizes.

  • Simple play stop mp3 trouble

    I have very limted action script knowlege but I found this http://www.tutorialized.com/view/tutorial/How-To-Create-A-Simple-Mp3-Player-In-Flash/34640 to tutorial and it seemed easy enough even though its an older version than what I have (I have cs3)