SSRS Expression Compare columns to first column in group

Hello, Experts,
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  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 creating the data set:
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 ratio of each week over week1 for each of the three rows (V1 Total, V1.1, V1.2) so that each cell
will be like
4000/6000, 2000/6000 for V1 Total,
3000/6000, 1600/6000 for V1.1,
1000/6000, 400/6000 for V1.2
I'm new to SSRS and totally stuck. Please help!!

Hello,
In your case, we can use an adjacent column group to work around the issue. Please refer to the following steps:
Base on your design, right-click “Week” in the Column Groups dialog box. Select Group Properties.
Click filter in the left pane. Click Add icon and fill with following values:
Expression: [Week]
Operator: =
Value: =”Week1”
Right-click “Week” in the Column Groups, select Add Group -> Adjacent After -> Group by: [Week].
Type the following expression to the corresponding text box of the adjacent group.
=Sum(Fields!Count.Value)/Reportitems!Textbox9.Value
(Note: TextBo9 is the text box which is calculate the sum value.)
Select the first Week column, right click it. Select Column Visibility. Select “Hide” option.
Please refer to the following screenshot:
If you have any questions, please feel free to let me know.
Regards,
Alisa Tang
Alisa Tang
TechNet Community Support

Similar Messages

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

  • GROUP BY: determinstic function column of group by expression 10g vs 11g

    The following works in 10g but now fails in 11g.
    Simple description: If I create a view of a number and subtract 2 from that number
    and I group by the first column and include the 2nd column, it works in 10g and gives "not a group by column" in 11g.
    It seems that 10g knew the 2nd column was derived by the first column so grouping by the 1st column gave an automatic pass to the 2nd column.
    11g seems to be more strict (though I don't know why, if the 2nd column's function is purely deterministic as you would expect subtracting by 2 would be. Same is true for UPPER())
    Is there a reason for this change in behaviour in 11g?
    Is there some explicit reason for the change in functionality?
    Exact versions and results below
    Line: -----
    Connected to:
    Oracle Database 10g Release 10.2.0.3.0 - Production
    SQL> drop view v1;
    View dropped.
    SQL> drop view v2;
    View dropped.
    SQL>
    SQL> create view v1 as
    2 select '0' c1, 0 c2 from dual
    3 union all
    4 select '1', 1 from dual
    5 union all
    6 select '2', 2 from dual
    7 union all
    8 select '3', 3 from dual;
    View created.
    SQL>
    SQL>
    SQL> create view v2
    2 as select c1, upper(c1) c1u, c2, c2-2 c3
    3 from v1;
    View created.
    SQL>
    SQL> select c1, c1u
    2 from v2
    3 group by c1;
    C C
    1 1
    3 3
    0 0
    2 2
    SQL>
    SQL> select c1, c2, c3
    2 from v2
    3 group by c1, c2;
    C C2 C3
    1 1 -1
    3 3 1
    2 2 0
    0 0 -2
    -- =============================================================================================
    Connected to:
    Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
    SQL> drop view v1;
    View dropped.
    SQL> drop view v2;
    View dropped.
    SQL>
    SQL> create view v1 as
    2 select '0' c1, 0 c2 from dual
    3 union all
    4 select '1', 1 from dual
    5 union all
    6 select '2', 2 from dual
    7 union all
    8 select '3', 3 from dual;
    View created.
    SQL>
    SQL>
    SQL> create view v2
    2 as select c1, upper(c1) c1u, c2, c2-2 c3
    3 from v1;
    View created.
    SQL>
    SQL> select c1, c1u
    2 from v2
    3 group by c1;
    select c1, c1u
    ERROR at line 1:
    ORA-00979: not a GROUP BY expression
    SQL>
    SQL> select c1, c2, c3
    2 from v2
    3 group by c1, c2;
    select c1, c2, c3
    ERROR at line 1:
    ORA-00979: not a GROUP BY expression
    Edited by: joriotis on Jul 25, 2011 11:01 AM
    Edited by: joriotis on Jul 25, 2011 11:03 AM

    Hi,
    Just 4 hours ago, someone else had a very similar question:
    Group by fails on ORA-00979
    Personally, I consider that a bug in Oracle 10. When you do a GROUP BY on a view, you can't expect the SQL engine to look at the view definition, and determine if one of the columns can be derived from another.
    In practice, it's easy enough to add c1u to the GROUP BY clause, or to use MAX (c1u) instead of c1u, to make your query work.

  • Timestamp in Messenger Express Received Column

    Hi,
    Does anyone know how to change the date/timestamp in the message list in the Messenger Express Received column from 24 hour format to 12 hour format? So instead of      "16:23" , it would say "4:33 pm"...
    Many thanks...

    When you first installed it, that was a choice. I suspect that there's a configutil setting. It's not for each user, but is global.
    No time to chase it down, today, sorry. I'll be gone all next week, too.

  • Comparing columns in table and triggers

    hi masters,
    i have oracle 10g in Linux and us PL/SQL developer to access database, ia m not a developer, but am assigned task to compare columns in table and associated trigger.
    let me explain, we have 800 tables, and each table essentially have a trigger created on it. the condition is that each trigger on table should include each column in table, that is columns in table and trigger should be same.
    now i don't understand how to compare them, rather can you suggest any query for the same?? and comparing 800 tables manually will be tedious job...
    i am unable to compare trigger columns with that of tables..
    how can we achieve this???
    any suggestions??
    thanks and regards
    VD

    Hi,
    A good starting point could be consult user_triggers view. Example:
    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
    Connected as hr
    SQL> desc user_triggers
    Name              Type           Nullable Default Comments                                                                   
    TRIGGER_NAME      VARCHAR2(30)   Y                Name of the trigger                                                        
    TRIGGER_TYPE      VARCHAR2(16)   Y                Type of the trigger (when it fires) - BEFORE/AFTER and STATEMENT/ROW       
    TRIGGERING_EVENT  VARCHAR2(227)  Y                Statement that will fire the trigger - INSERT, UPDATE and/or DELETE        
    TABLE_OWNER       VARCHAR2(30)   Y                Owner of the table that this trigger is associated with                    
    BASE_OBJECT_TYPE  VARCHAR2(16)   Y                                                                                           
    TABLE_NAME        VARCHAR2(30)   Y                Name of the table that this trigger is associated with                     
    COLUMN_NAME       VARCHAR2(4000) Y                The name of the column on which the trigger is defined over                
    REFERENCING_NAMES VARCHAR2(128)  Y                Names used for referencing to OLD, NEW and PARENT values within the trigger
    WHEN_CLAUSE       VARCHAR2(4000) Y                WHEN clause must evaluate to true in order for triggering body to execute  
    STATUS            VARCHAR2(8)    Y                If DISABLED then trigger will not fire                                     
    DESCRIPTION       VARCHAR2(4000) Y                Trigger description, useful for re-creating trigger creation statement     
    ACTION_TYPE       VARCHAR2(11)   Y                                                                                           
    TRIGGER_BODY      LONG           Y                Action taken by this trigger when it fires                                 
    SQL> select * from user_triggers;
    TRIGGER_NAME                   TRIGGER_TYPE     TRIGGERING_EVENT                                                                 TABLE_OWNER                    BASE_OBJECT_TYPE TABLE_NAME                     COLUMN_NAME                                                                      REFERENCING_NAMES                                                                WHEN_CLAUSE                                                                      STATUS   DESCRIPTION                                                                      ACTION_TYPE TRIGGER_BODY
    TRGTEST                        BEFORE STATEMENT INSERT                                                                           HR                             TABLE            DEPARTMENTS                                                                                                     REFERENCING NEW AS NEW OLD AS OLD                                                                                                                                 ENABLED  trgTest                                                                          PL/SQL      DECLARE
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  before insert on departments                                                                   -- local variables here
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             BEGIN
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 nul;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             END trgTest;
    UPDATE_JOB_HISTORY             AFTER EACH ROW   UPDATE                                                                           HR                             TABLE            EMPLOYEES                                                                                                       REFERENCING NEW AS NEW OLD AS OLD                                                                                                                                 ENABLED  update_job_history                                                               PL/SQL      BEGIN
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  AFTER UPDATE OF job_id, department_id ON employees                                           add_job_history(:old.employee_id, :old.hire_date, sysdate,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  FOR EACH ROW                                                                              
    SECURE_EMPLOYEES               BEFORE STATEMENT INSERT OR UPDATE OR DELETE                                                       HR                             TABLE            EMPLOYEES                                                                                                       REFERENCING NEW AS NEW OLD AS OLD                                                                                                                                 ENABLED  secure_employees                                                                 PL/SQL      BEGIN
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  BEFORE INSERT OR UPDATE OR DELETE ON employees                                               secure_dml;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             END secure_employees;
    RK_ALT_BEF_TRG                 AFTER EVENT      ALTER                                                                            HR                             SCHEMA                                                                                                                           REFERENCING NEW AS NEW OLD AS OLD                                                                                                                                 ENABLED  rk_alt_bef_trg                                                                   PL/SQL      BEGIN
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                AFTER ALTER ON HR.SCHEMA                                                                         dbms_output.put_line('AFTER Schema trigger fired');
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 dbms_output.
    SQL> Regards,

  • 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

  • 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

  • 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

  • The order of the columns in GROUP BY doesn`t matter?  why?

    I did a little test and find out that the order of the columns in GROUP BY does not matter to ORACLE.
    Why? How does oracle do GROUP BY exactly?
    Could anyone show me its processing logic? maybe in pseudo-code?
    Thanks in advance.

    I mean,
    I thought oracle would group data based on the order of the columns in the GROUP BY LIST.
    For example: for select deptno, job, count(*) from emp group by deptno, job;
    I thought, oracle first would group the data based on deptno (10,20,30), e.g. in deptno=30, we got 6 employees.
    and then, group this 6 employees based on JOB (CLERK, SALESMAN, MANAGER).and
    for select job, deptno, count(*) from emp group by job, deptno;
    first would group the data based on JOB (CLERK, SALESMAN, MANAGER) e.g., for CLERK, we got 4 employees,
    and then, group this 4 employees based on deptno (10,20, 30).and to me, it seems that in some circumstances, their result could be different.
    So, I wonder if the order of the columns in GROUP BY Clause matter?

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

  • 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

Maybe you are looking for

  • Find and Change in PDF

    Is there a way to find change in Acrobat Pro--any version-- Lets say you want to change all instances of the word "state" to the word "city" Is this possible with todays technology to do this in a PDF? Thanks ...I entered in this question in the ask

  • HT1657 Rental movie disappears from PC after transfer and never shows up on iPad

    Article says I can transfer movie rental from my PC to my iPad (1) and that it can only exist ion device at a time. I transferred the movie, it disappeared from my PC (in Rentals catregory), but never showed up on my iPad. What now?

  • WBS in Account assignment of Sales Contract

    Dear Experts, I am going through an old sales cotnract in VA43, and i came accross the account assignment tab where there is WBS field. When does a sales guy use that. I thought it was only used for projects and ultimately an asset.Please advice coz

  • Cant access iCloud mail, and it won't remember my password on iPhone

    Hello, I cant access icloud through my web browser, it keeps saying: ORIGIN server TYPE error BUILDNUMBER 1FCS29.34215 TIME Tue Nov 15 2011 11:23:32 GMT+0000 (GMT)        (1321356212070) HOST www.icloud.com USERAGENT Mozilla/5.0 (Macintosh; Intel Mac

  • NEWBIE BUILDER NEEDS HELP

    I'm having a problem with my newly built P.C. that I hope someone can help me with. When I turn the power on,  the P.C. powers up for about 5 seconds and then there is one beep sound and then the power goes out on it. What is causing this problem and