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

Similar Messages

  • SSRS Expression Help, Default to Current Month UNLESS it is the First Day thru the 5th Day, then go to previous month?

    Hello,
    I need to write an expression for the default month parameter for a report.
    Report data is imported on the 5th of each month for the previous months data.
    currently my expression is this =IIf(Month(DateAdd("m",-1,today ()))
    I need an iff statement that says if todays date is 1-5 then set the default to (Month(DateAdd("m",-2,today ()))
    Ill then display a otherwise hidden text box that reads the previous months data is not availble untill after the 5th, displayed is data from 2 months ago, or something to that effect.
    Thanks.

    iif(datepart(dateInterval.Day,now()) <= 5, datepart(dateInterval.month,now()), datepart(dateInterval.month,now())-1)

  • 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.

  • 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

  • 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

  • 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 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

  • Will an Airport Express help with the signal I am not receiving on my Smart TV?

    Will the Express help with internet issue's I have with my new Smart TV?

    If you already have another Apple AirPort router that is providing your wireless signal, then a new AirPort Express could extend that wireless signal to provide a stronger wireless signal to the TV....assuming that the TV connects using wireless.
    Is this what you are asking?
    Or, would the Express provide other services to "help"?

  • 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

  • My ipad 2 and ipod touch keeps on dropping wifi connection,  would getting an apple router or maybe airport express help?

    ipad 2 and ipod touch  keeps on dropping wifi, would upgrading to an apple router/airport express help?  all my other pc's work well with my current network.

    Have you checked for a firmware update for your current router?
    What make, model, version router do you have?

Maybe you are looking for