Ssrs iif expression

In an ssrs 2008 r2 report, I need to place a 'customer short name' in a detail line when the field has a value in it. When there is no value in the 'customer short name', I am suppose to use the 'customer long name'.
Thus can you should me how to setup this code in an iif expression?

You should write your expression something like below.
=IIF(IsNothing(Fields!customer_short_name.Value), Fields!customer_long_name.Value, Fields!customer_short_name.Value)
Ione

Similar Messages

  • Report Builder 3.0 IIF Expression

    I would like my expression to read: IF the value of Finalsign = 1 and CONT_ACTION =7 then calculate the date (time) difference between the ID (start date) and CONT_TIME (end date).  I would like to only display the count of the documents
    that were 24 hours from start to finish.
    This is the first part of what I have.
    IIF (Fields!FINALSIGN.Value = 1 then DateDiff ("h",Fields!ID.Value, Fields!CONTB_TIME.Value))
    I get the error message:  The Value expression for the textrun 'FINALSIGN1.Paragraphs[0]' contains an error: [BC30455] Argument not specified for parameter 'FalsePart' of 'Public Function IIF (Expression  As Boolean, TruePart As
    Object, False Part As Object) As Object'.

    SELECT
       dbo.Convert_Id_to_Date(DOCUMENT.CLINICALDATE) ,DOCUMENT.FINALSIGN
      ,DOCUMENT.STATUS,DoctorFacility.ListName
      ,DOCTYPES.DESCRIPTION,DOCUMENT.JOBTITLE
      ,PatientProfile.PatientId,DOCUMENT.DID
      ,DOCUMENT.VISDOCID,PatientProfile.searchname
      ,DOCUMENT.SUMMARY,DOCCONTB.CONTB_ACTION
      ,DOCCONTB.CONTB_TIME,DoctorFacility.Ledger
    FROM
      DOCUMENT
      INNER JOIN DOCTYPES
        ON DOCUMENT.DOCTYPE = DOCTYPES.DTID
      INNER JOIN DoctorFacility
        ON DOCUMENT.USRID = DoctorFacility.PVId
      INNER JOIN PatientProfile
        ON DOCUMENT.PID = PatientProfile.PId
      INNER JOIN DOCCONTB
        ON DOCUMENT.SDID = DOCCONTB.SDID
    WHERE
      dbo.Convert_Id_to_Date(DOCUMENT.CLINICALDATE) BETWEEN (@StartDate) AND (@EndDate)
      AND (PatientProfile.searchname <> 'Test')
      AND (DOCTYPES.DESCRIPTION = 'Office Visit'
       OR DOCTYPES.DESCRIPTION = 'Gyn Office Visit'
       OR DOCTYPES.DESCRIPTION = 'OB Office Visit')
      AND (DOCUMENT.JOBTITLE = 'FacultyPhysician'
       OR DOCUMENT.JOBTITLE = 'FellowPhysician'
       OR DOCUMENT.JOBTITLE = 'LicensedMidlevel'
       OR DOCUMENT.JOBTITLE = 'R1_Resident'
       OR DOCUMENT.JOBTITLE = 'R2_Resident'
       OR DOCUMENT.JOBTITLE = 'R3_Resident')
      AND (DOCCONTB.CONTB_ACTION = 0     =Create
       OR DOCCONTB.CONTB_ACTION = 7)      =Final Signature
      AND DoctorFacility.ListName<>'abc'
      AND DoctorFacility.ListName<>'123'
    ORDER BY
      DOCTORFACILITY.LEDGER,DOCTORFACILITY.LISTNAME,PATIENTPROFILE.PATIENTID,DOCCONTB.CONTB_ACTION DESC;
    This is the query.  The provider name will be in the first column, the total of all office visits for a provider in column2, the total of all office visits signed within 24 hours in the 3rd column, and the % of all office visits signed within 24
    hours in the 4th column.

  • SSRS IIF Returning #ERROR

    I have an expression in my SSRS report that calculates a field Total across multiple groups:
    =IIf(SUM(Fields!sales_Dollars.Value) > 0 ,(SUM(Fields!Total_Defective__.Value)/IIF(SUM(Fields!sales_Dollars.Value) <= 0, 1, SUM(Fields!sales_Dollars.Value))),0)
    I had to alter it by adding groups within the statement:
    =SUM(IIf(SUM(Fields!sales_Dollars.Value,"Item_Process_Group") > 0 ,(SUM(Fields!Total_Defective__.Value,"Item_Process_Group")/IIF(SUM(Fields!sales_Dollars.Value,"Item_Process_Group") <= 0, 1, SUM(Fields!sales_Dollars.Value,"Item_Process_Group"))),0))
    The problem is that there is a 0 in the denominator of one of the rows in the calc that is not in the group specified in the clause. This causes an #error. (at least I believe this is the cause)
    is there a way to slip in a check for zero in **Fields!sales_Dollars.Value** with no group? sort of like how it does it in the first code example.
    I need the group names in the bottom portion to pull the correct values.

    Hi,
    I have tested with your sample data, its working fine for me with your expression as shown in the below screen.
    you can see my sample RDL.
    <?xml version="1.0" encoding="utf-8"?>
    <Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
    <Body>
    <ReportItems>
    <Tablix Name="table1">
    <TablixBody>
    <TablixColumns>
    <TablixColumn>
    <Width>1in</Width>
    </TablixColumn>
    <TablixColumn>
    <Width>1in</Width>
    </TablixColumn>
    <TablixColumn>
    <Width>1in</Width>
    </TablixColumn>
    <TablixColumn>
    <Width>1in</Width>
    </TablixColumn>
    </TablixColumns>
    <TablixRows>
    <TablixRow>
    <Height>0.22in</Height>
    <TablixCells>
    <TablixCell>
    <CellContents>
    <Textbox Name="textbox2">
    <CanGrow>true</CanGrow>
    <KeepTogether>true</KeepTogether>
    <Paragraphs>
    <Paragraph>
    <TextRuns>
    <TextRun>
    <Value>Process</Value>
    <Style>
    <FontFamily>Tahoma</FontFamily>
    <FontSize>11pt</FontSize>
    <FontWeight>Bold</FontWeight>
    <Color>White</Color>
    </Style>
    </TextRun>
    </TextRuns>
    <Style />
    </Paragraph>
    </Paragraphs>
    <rd:DefaultName>textbox2</rd:DefaultName>
    <Style>
    <Border>
    <Color>LightGrey</Color>
    <Style>Solid</Style>
    </Border>
    <BackgroundColor>SteelBlue</BackgroundColor>
    <PaddingLeft>2pt</PaddingLeft>
    <PaddingRight>2pt</PaddingRight>
    <PaddingTop>2pt</PaddingTop>
    <PaddingBottom>2pt</PaddingBottom>
    </Style>
    </Textbox>
    </CellContents>
    </TablixCell>
    <TablixCell>
    <CellContents>
    <Textbox Name="textbox3">
    <CanGrow>true</CanGrow>
    <KeepTogether>true</KeepTogether>
    <Paragraphs>
    <Paragraph>
    <TextRuns>
    <TextRun>
    <Value>Total Defective </Value>
    <Style>
    <FontFamily>Tahoma</FontFamily>
    <FontSize>11pt</FontSize>
    <FontWeight>Bold</FontWeight>
    <Color>White</Color>
    </Style>
    </TextRun>
    </TextRuns>
    <Style>
    <TextAlign>Right</TextAlign>
    </Style>
    </Paragraph>
    </Paragraphs>
    <rd:DefaultName>textbox3</rd:DefaultName>
    <Style>
    <Border>
    <Color>LightGrey</Color>
    <Style>Solid</Style>
    </Border>
    <BackgroundColor>SteelBlue</BackgroundColor>
    <PaddingLeft>2pt</PaddingLeft>
    <PaddingRight>2pt</PaddingRight>
    <PaddingTop>2pt</PaddingTop>
    <PaddingBottom>2pt</PaddingBottom>
    </Style>
    </Textbox>
    </CellContents>
    </TablixCell>
    <TablixCell>
    <CellContents>
    <Textbox Name="textbox4">
    <CanGrow>true</CanGrow>
    <KeepTogether>true</KeepTogether>
    <Paragraphs>
    <Paragraph>
    <TextRuns>
    <TextRun>
    <Value>sales Dollars</Value>
    <Style>
    <FontFamily>Tahoma</FontFamily>
    <FontSize>11pt</FontSize>
    <FontWeight>Bold</FontWeight>
    <Color>White</Color>
    </Style>
    </TextRun>
    </TextRuns>
    <Style>
    <TextAlign>Right</TextAlign>
    </Style>
    </Paragraph>
    </Paragraphs>
    <rd:DefaultName>textbox4</rd:DefaultName>
    <Style>
    <Border>
    <Color>LightGrey</Color>
    <Style>Solid</Style>
    </Border>
    <BackgroundColor>SteelBlue</BackgroundColor>
    <PaddingLeft>2pt</PaddingLeft>
    <PaddingRight>2pt</PaddingRight>
    <PaddingTop>2pt</PaddingTop>
    <PaddingBottom>2pt</PaddingBottom>
    </Style>
    </Textbox>
    </CellContents>
    </TablixCell>
    <TablixCell>
    <CellContents>
    <Textbox Name="Textbox5">
    <CanGrow>true</CanGrow>
    <KeepTogether>true</KeepTogether>
    <Paragraphs>
    <Paragraph>
    <TextRuns>
    <TextRun>
    <Value>COQ</Value>
    <Style>
    <FontFamily>Tahoma</FontFamily>
    <FontSize>11pt</FontSize>
    <FontWeight>Bold</FontWeight>
    <Color>White</Color>
    </Style>
    </TextRun>
    </TextRuns>
    <Style>
    <TextAlign>Right</TextAlign>
    </Style>
    </Paragraph>
    </Paragraphs>
    <rd:DefaultName>Textbox5</rd:DefaultName>
    <Style>
    <Border>
    <Color>LightGrey</Color>
    <Style>Solid</Style>
    </Border>
    <BackgroundColor>SteelBlue</BackgroundColor>
    <PaddingLeft>2pt</PaddingLeft>
    <PaddingRight>2pt</PaddingRight>
    <PaddingTop>2pt</PaddingTop>
    <PaddingBottom>2pt</PaddingBottom>
    </Style>
    </Textbox>
    </CellContents>
    </TablixCell>
    </TablixCells>
    </TablixRow>
    <TablixRow>
    <Height>0.21in</Height>
    <TablixCells>
    <TablixCell>
    <CellContents>
    <Textbox Name="Process">
    <CanGrow>true</CanGrow>
    <KeepTogether>true</KeepTogether>
    <Paragraphs>
    <Paragraph>
    <TextRuns>
    <TextRun>
    <Value>=Fields!Process.Value</Value>
    <Style>
    <FontFamily>Tahoma</FontFamily>
    </Style>
    </TextRun>
    </TextRuns>
    <Style />
    </Paragraph>
    </Paragraphs>
    <rd:DefaultName>Process</rd:DefaultName>
    <Style>
    <Border>
    <Color>LightGrey</Color>
    <Style>Solid</Style>
    </Border>
    <PaddingLeft>2pt</PaddingLeft>
    <PaddingRight>2pt</PaddingRight>
    <PaddingTop>2pt</PaddingTop>
    <PaddingBottom>2pt</PaddingBottom>
    </Style>
    </Textbox>
    </CellContents>
    </TablixCell>
    <TablixCell>
    <CellContents>
    <Textbox Name="Total_Defective__">
    <CanGrow>true</CanGrow>
    <KeepTogether>true</KeepTogether>
    <Paragraphs>
    <Paragraph>
    <TextRuns>
    <TextRun>
    <Value>=Fields!Total_Defective__.Value</Value>
    <Style>
    <FontFamily>Tahoma</FontFamily>
    </Style>
    </TextRun>
    </TextRuns>
    <Style />
    </Paragraph>
    </Paragraphs>
    <rd:DefaultName>Total_Defective__</rd:DefaultName>
    <Style>
    <Border>
    <Color>LightGrey</Color>
    <Style>Solid</Style>
    </Border>
    <PaddingLeft>2pt</PaddingLeft>
    <PaddingRight>2pt</PaddingRight>
    <PaddingTop>2pt</PaddingTop>
    <PaddingBottom>2pt</PaddingBottom>
    </Style>
    </Textbox>
    </CellContents>
    </TablixCell>
    <TablixCell>
    <CellContents>
    <Textbox Name="sales_Dollars">
    <CanGrow>true</CanGrow>
    <KeepTogether>true</KeepTogether>
    <Paragraphs>
    <Paragraph>
    <TextRuns>
    <TextRun>
    <Value>=Fields!sales_Dollars.Value</Value>
    <Style>
    <FontFamily>Tahoma</FontFamily>
    </Style>
    </TextRun>
    </TextRuns>
    <Style />
    </Paragraph>
    </Paragraphs>
    <rd:DefaultName>sales_Dollars</rd:DefaultName>
    <Style>
    <Border>
    <Color>LightGrey</Color>
    <Style>Solid</Style>
    </Border>
    <PaddingLeft>2pt</PaddingLeft>
    <PaddingRight>2pt</PaddingRight>
    <PaddingTop>2pt</PaddingTop>
    <PaddingBottom>2pt</PaddingBottom>
    </Style>
    </Textbox>
    </CellContents>
    </TablixCell>
    <TablixCell>
    <CellContents>
    <Textbox Name="Textbox6">
    <CanGrow>true</CanGrow>
    <KeepTogether>true</KeepTogether>
    <Paragraphs>
    <Paragraph>
    <TextRuns>
    <TextRun>
    <Value>=iif( Fields!Total_Defective__.Value&gt;0, Fields!Total_Defective__.Value/Fields!sales_Dollars.Value,0)</Value>
    <Style>
    <FontFamily>Tahoma</FontFamily>
    <Format>0.00;(0.00)</Format>
    </Style>
    </TextRun>
    </TextRuns>
    <Style />
    </Paragraph>
    </Paragraphs>
    <rd:DefaultName>Textbox6</rd:DefaultName>
    <Style>
    <Border>
    <Color>LightGrey</Color>
    <Style>Solid</Style>
    </Border>
    <PaddingLeft>2pt</PaddingLeft>
    <PaddingRight>2pt</PaddingRight>
    <PaddingTop>2pt</PaddingTop>
    <PaddingBottom>2pt</PaddingBottom>
    </Style>
    </Textbox>
    </CellContents>
    </TablixCell>
    </TablixCells>
    </TablixRow>
    <TablixRow>
    <Height>0.25in</Height>
    <TablixCells>
    <TablixCell>
    <CellContents>
    <Textbox Name="Textbox26">
    <CanGrow>true</CanGrow>
    <KeepTogether>true</KeepTogether>
    <Paragraphs>
    <Paragraph>
    <TextRuns>
    <TextRun>
    <Value />
    <Style>
    <FontFamily>Tahoma</FontFamily>
    </Style>
    </TextRun>
    </TextRuns>
    <Style />
    </Paragraph>
    </Paragraphs>
    <rd:DefaultName>Textbox26</rd:DefaultName>
    <Style>
    <Border>
    <Color>LightGrey</Color>
    <Style>Solid</Style>
    </Border>
    <PaddingLeft>2pt</PaddingLeft>
    <PaddingRight>2pt</PaddingRight>
    <PaddingTop>2pt</PaddingTop>
    <PaddingBottom>2pt</PaddingBottom>
    </Style>
    </Textbox>
    </CellContents>
    </TablixCell>
    <TablixCell>
    <CellContents>
    <Textbox Name="Total_Defective__1">
    <CanGrow>true</CanGrow>
    <KeepTogether>true</KeepTogether>
    <Paragraphs>
    <Paragraph>
    <TextRuns>
    <TextRun>
    <Value>=Sum(Fields!Total_Defective__.Value)</Value>
    <Style>
    <FontFamily>Tahoma</FontFamily>
    </Style>
    </TextRun>
    </TextRuns>
    <Style />
    </Paragraph>
    </Paragraphs>
    <rd:DefaultName>Total_Defective__1</rd:DefaultName>
    <Style>
    <Border>
    <Color>LightGrey</Color>
    <Style>Solid</Style>
    </Border>
    <PaddingLeft>2pt</PaddingLeft>
    <PaddingRight>2pt</PaddingRight>
    <PaddingTop>2pt</PaddingTop>
    <PaddingBottom>2pt</PaddingBottom>
    </Style>
    </Textbox>
    </CellContents>
    </TablixCell>
    <TablixCell>
    <CellContents>
    <Textbox Name="sales_Dollars1">
    <CanGrow>true</CanGrow>
    <KeepTogether>true</KeepTogether>
    <Paragraphs>
    <Paragraph>
    <TextRuns>
    <TextRun>
    <Value>=Sum(Fields!sales_Dollars.Value)</Value>
    <Style>
    <FontFamily>Tahoma</FontFamily>
    </Style>
    </TextRun>
    </TextRuns>
    <Style />
    </Paragraph>
    </Paragraphs>
    <rd:DefaultName>sales_Dollars1</rd:DefaultName>
    <Style>
    <Border>
    <Color>LightGrey</Color>
    <Style>Solid</Style>
    </Border>
    <PaddingLeft>2pt</PaddingLeft>
    <PaddingRight>2pt</PaddingRight>
    <PaddingTop>2pt</PaddingTop>
    <PaddingBottom>2pt</PaddingBottom>
    </Style>
    </Textbox>
    </CellContents>
    </TablixCell>
    <TablixCell>
    <CellContents>
    <Textbox Name="Textbox29">
    <CanGrow>true</CanGrow>
    <KeepTogether>true</KeepTogether>
    <Paragraphs>
    <Paragraph>
    <TextRuns>
    <TextRun>
    <Value>=SUM(IIf(SUM(Fields!sales_Dollars.Value,"Item_Process_Group") &gt; 0 ,(SUM(Fields!Total_Defective__.Value,"Item_Process_Group")/IIF(SUM(Fields!sales_Dollars.Value,"Item_Process_Group") &lt;= 0, 1, SUM(Fields!sales_Dollars.Value,"Item_Process_Group"))),0))</Value>
    <Style>
    <FontFamily>Tahoma</FontFamily>
    </Style>
    </TextRun>
    </TextRuns>
    <Style />
    </Paragraph>
    </Paragraphs>
    <rd:DefaultName>Textbox29</rd:DefaultName>
    <Style>
    <Border>
    <Color>LightGrey</Color>
    <Style>Solid</Style>
    </Border>
    <PaddingLeft>2pt</PaddingLeft>
    <PaddingRight>2pt</PaddingRight>
    <PaddingTop>2pt</PaddingTop>
    <PaddingBottom>2pt</PaddingBottom>
    </Style>
    </Textbox>
    </CellContents>
    </TablixCell>
    </TablixCells>
    </TablixRow>
    </TablixRows>
    </TablixBody>
    <TablixColumnHierarchy>
    <TablixMembers>
    <TablixMember />
    <TablixMember />
    <TablixMember />
    <TablixMember />
    </TablixMembers>
    </TablixColumnHierarchy>
    <TablixRowHierarchy>
    <TablixMembers>
    <TablixMember>
    <KeepTogether>true</KeepTogether>
    </TablixMember>
    <TablixMember>
    <Group Name="Item_Process_Group">
    <GroupExpressions>
    <GroupExpression>=Fields!Process.Value</GroupExpression>
    </GroupExpressions>
    </Group>
    <SortExpressions>
    <SortExpression>
    <Value>=Fields!Process.Value</Value>
    </SortExpression>
    </SortExpressions>
    <TablixMembers>
    <TablixMember>
    <Group Name="table1_Details_Group">
    <DataElementName>Detail</DataElementName>
    </Group>
    <TablixMembers>
    <TablixMember />
    </TablixMembers>
    <DataElementName>Detail_Collection</DataElementName>
    <DataElementOutput>Output</DataElementOutput>
    <KeepTogether>true</KeepTogether>
    </TablixMember>
    <TablixMember>
    <KeepWithGroup>Before</KeepWithGroup>
    </TablixMember>
    </TablixMembers>
    </TablixMember>
    </TablixMembers>
    </TablixRowHierarchy>
    <DataSetName>DataSet1</DataSetName>
    <Top>0.37in</Top>
    <Height>0.68in</Height>
    <Width>4in</Width>
    <Style />
    </Tablix>
    <Textbox Name="textbox1">
    <CanGrow>true</CanGrow>
    <KeepTogether>true</KeepTogether>
    <Paragraphs>
    <Paragraph>
    <TextRuns>
    <TextRun>
    <Value>IIF</Value>
    <Style>
    <FontFamily>Tahoma</FontFamily>
    <FontSize>16pt</FontSize>
    <FontWeight>Bold</FontWeight>
    <Color>SteelBlue</Color>
    </Style>
    </TextRun>
    </TextRuns>
    <Style>
    <TextAlign>Center</TextAlign>
    </Style>
    </Paragraph>
    </Paragraphs>
    <rd:DefaultName>textbox1</rd:DefaultName>
    <Height>0.37in</Height>
    <Width>5in</Width>
    <ZIndex>1</ZIndex>
    <Style>
    <PaddingLeft>2pt</PaddingLeft>
    <PaddingRight>2pt</PaddingRight>
    <PaddingTop>2pt</PaddingTop>
    <PaddingBottom>2pt</PaddingBottom>
    </Style>
    </Textbox>
    </ReportItems>
    <Height>1.3in</Height>
    <Style />
    </Body>
    <Width>5in</Width>
    <Page>
    <LeftMargin>1in</LeftMargin>
    <RightMargin>1in</RightMargin>
    <TopMargin>1in</TopMargin>
    <BottomMargin>1in</BottomMargin>
    <Style />
    </Page>
    <AutoRefresh>0</AutoRefresh>
    <DataSources>
    <DataSource Name="DataSource1">
    <DataSourceReference>DataSource1</DataSourceReference>
    <rd:SecurityType>None</rd:SecurityType>
    <rd:DataSourceID>0404c681-a734-438b-8708-447809487513</rd:DataSourceID>
    </DataSource>
    </DataSources>
    <DataSets>
    <DataSet Name="DataSet1">
    <Query>
    <DataSourceName>DataSource1</DataSourceName>
    <CommandText>select *
    from sales</CommandText>
    <rd:UseGenericDesigner>true</rd:UseGenericDesigner>
    </Query>
    <Fields>
    <Field Name="Process">
    <DataField>Process</DataField>
    <rd:TypeName>System.String</rd:TypeName>
    </Field>
    <Field Name="Total_Defective__">
    <DataField>Total_Defective__</DataField>
    <rd:TypeName>System.Decimal</rd:TypeName>
    </Field>
    <Field Name="sales_Dollars">
    <DataField>sales_Dollars</DataField>
    <rd:TypeName>System.Decimal</rd:TypeName>
    </Field>
    </Fields>
    </DataSet>
    </DataSets>
    <Language>en-US</Language>
    <ConsumeContainerWhitespace>true</ConsumeContainerWhitespace>
    <rd:ReportUnitType>Inch</rd:ReportUnitType>
    <rd:ReportID>4435f425-143e-441c-b41a-7c5407db2b37</rd:ReportID>
    </Report>
    Run the RDL by create sample table and data as shown below:-
    create table Sales(Process Varchar(50),Total_Defective__  numeric (10,2),sales_Dollars numeric(10,2))
    insert into Sales values
    ('abc',0,2423.74)
    ,('abc',0,1184.64)
    ,('abc',15.02,569.72)
    ,('abc',26.79,0)
    ,('abc',4.05,22894.08)
    ,('abc',0,3333.63)
    ,('abc',18.42,372.60)
    ,('abc',0,465.35)
    ,('abc',0,1521.16)
    ,('abc',512.44,99142.67)
    ,('abc',6010.07,245804.00)
    ,('abc',81.79,9607.20)
    ,('abc',00.00,34597.74)
    ,('abc',00.00,27592.20)
    ,('abc',2187.23,40543.52)
    ,('abc',251.71,58263.60)
    ,('abc',44.32,45551.34)
    You edit my RDL and try to stimulate your issue and send it to me.. my RDL is in 2012.
    Thanks
    Prasad

  • IIf Expression: The first of many questions. Thank you in advance.

    One of the situations I am in need of assistance with is the following "IIf" statement:
    =IIf([Check36]=Off,10,0)           The expression is located in a field [LateFee].
    When, [Check36], is Off, $10.00 is displayed, if On then $0.00 is displayed.
    I have come to conclusion that this statement is correct and functional, although, it is not complete to my necessity.
    I'm wanting to include another action to the expression:
    =IIf([Check36]=off >=11th Day of any month then,10,0)
    In effect, what I would  like to express is that if the Check Box [Check36] is Off any Day of the Month > = to the 11th Day, then the [LateFee] will display 10,0
    Pardon the inquisition, although, I've really caught the bug and I would like to locate the correct answer. 
    Jason

    You don't need '=Off'.  A check box control has a value of a Boolean TRUE or FALSE, so simply reference the control by name:
        =IIf([Check36] And Day(Date())>10 And Time() > #12:00#,10,0)
    This will return 10 if the value of the check box is TRUE and the current date is after the 10th of the month, zero otherwise.  You can see how it works in the debug window today, 6th march at 12:50 PM with:
    Check36 = TRUE
    ? IIf(Check36 And Day(Date())>10 And Time() > #12:00#,10,0)
     0
    If we change the expression so that the relevant date is after 5th of the current month, yesterday as of now, we get 10:
    ? IIf(Check36 And Day(Date())>5 And Time() > #12:00#,10,0)
     10
    If we change the Boolean value to FALSE:
    Check36 = FALSE
    we now get zero:
    ? IIf(Check36 And Day(Date())>5 And Time() > #12:00#,10,0)
     0
    Is this what you are aiming at?
    However, I'd recommend that you don't accept the default name like Check36 which Access gives to a control when you add it to form, but change it to some meaningful such as chkLatePayment.  Always do this immediately on adding a control to a form, not
    after you've inserted any code in one f the control's event procedures.  If you change the name afterwards the link between the control and the event procedure will be broken.
    Ken Sheridan, Stafford, England

  • SSRS IIF Statement #Error

    All,
    I have the below IIF statement in SSRS report based on a sharepoint list. However I get #Error only on certain lines
    For example when Item_Name = P001-P384D630Z01
    I am sort of stunned at this point. All the other lines work except the one with above item name. If I remove the MF5 Mod Center part of the iif then everything works.
    =
    Iif((mid(Fields!Item_Name.Value,8,1)= 3 OR mid(Fields!Item_Name.Value),8,1)=4) AND LEFT(TRIM(Fields!Project_No.Value),1) =8, "MF5 Mod Center",
    Iif(Left(Fields!Project_No.Value,1)="3","HOU MOD",
    Iif(Left(Fields!Item_Name.Value,3) = "RDC","RDC",
    Iif(Left(Fields!Item_Name.Value,4) = "P001","Overseas",
    Iif(IsNothing(Fields!Engineering_Status.Value), "Pre-engineering",
    Iif(Fields!Engineering_Status.Value="P.C. Finished", "Production",
    Fields!Engineering_Status.Value

    It's working after removing the "-" in the item_name if anyone is wondering.
    =
    Iif(Left(Fields!Project_No.Value,1)="3","HOU MOD",
    Iif(Left(Fields!Item_Name.Value,3) = "RDC","RDC",
    Iif(Left(Fields!Item_Name.Value,4) = "P001","Overseas",
    Iif(IsNothing(Fields!Engineering_Status.Value), "Pre-engineering",
    Iif(Fields!Engineering_Status.Value="P.C. Finished", "Production",
    Iif((mid(replace(Fields!Item_Name.Value,"-",""),8,1)= 3 OR mid(replace(Fields!Item_Name.Value,"-",""),8,1)=4) AND LEFT(TRIM(Fields!Project_No.Value),1) =8, "MF5 Mod Center"
    ,Fields!Engineering_Status.Value

  • Using nested IIF expressions in an update query - is it possible?

    Hi everyone,
    I've been tasked by my manager to build a database which replicates a large, complicated Excel spreadsheet that consumes too much of our team's time and system resources. I've just about got most of it, but there is one particular required field that, in
    Excel, requires multi-layered nested If/Then formulae. I have to ask if building something similar in Access is possible. Here is the problem and the logic:
    Let us assume two established fields, Field 1 and Field 2; and then one field to be created via Update query, Field 3.
    Let us further assume that in Fields 1 and 2, there are three specific alphanumeric sequences occurring (“X1A”, “X1”, and “Z1”) that need to be identified and then called out as either “S1” or “U1” in field 3.
    If an Update Query were to be written to populate Field 3 with either “S1” or “U1” depending on one of the three alphanumeric sequences appearing in either Field 1 or Field 2, could it be written as the following expression, using the IIF and OR operators?
    And if so, is the syntax of the following expression correct?
    IIf([FIELD 1]="* X1A", "U1", OR IIf([FIELD 2]="* X1", "U1", OR IIf([FIELD 2]="* Z1", "U1", OR IIf([FIELD 1]="* X1", "U1", OR IIf([FIELD 1]="* Z1", "U1", "S1")))))
    Any help, critiques, or guidance would be appreciated.

    IMHO, a main consideration when "migrating" from Excel to Access is that a relational database is fundamentally different from a spreadsheet (although there can be much overlap).  In Excel, calculated values are "live" (unless you paste the values only
    into some other cells).  To replicate this "live" quality in Access, you can use a query with a calculation to display (not create or update) Field 3 in your case; Field 3 really wouldn't be a field, just a representation (query, form, report) or snapshot
    (export, print).  One reason for this is to avoid conflicts and redundancy.  In other words, if Field 3 is based solely on Fields 1 & 2 and some rule, then usually there is no need to waste disk space to store Field 3 and you don't risk Field
    3 being wrong as in the case when the rule changes.
    So here are a couple of options.
    1) Create view only query to display Field 3.  In query design view, enter the following where you would normally select a field:
    [FIELD 3]: IIf([FIELD 1]="* X1A", "U1", IIf([FIELD 2]="* X1", "U1", IIf([FIELD 2]="* Z1", "U1", IIf([FIELD 1]="* X1", "U1", IIf([FIELD 1]="* Z1", "U1", "S1")))))
    I assume you literally mean the asterisk character and are not trying to invoke a wildcard for the LIKE operator.
    There are other ways of doing this (e.g. with the LIKE operator or multiple queries and UNION), but I leave that up to you to explore.
    2) Actually update the value of FIELD 3 in a table.  Create two update queries and use your rules as conditions (i.e. the criteria in the bottom of query design).
    a) Update query 1 (run first): set [FIELD 3] = "U1" where [FIELD 1] = "* X1A" OR [FIELD 1] = "* X1" OR [FIELD 1] = "* Z1" OR [FIELD 2] = "* X1" OR [FIELD 2] = "* Z1"
    b) Update query 2 (run after): set [FIELD 3] = "S1" where [FIELD 3] is null
    Again, there are other ways of doing this such as setting the default value of [FIELD 3] in the table to "S1" and just running update query 1.
    Good luck.

  • Average based on iif expression criteria

    Hi this is my test code
    create table #tmp1 (matter_ref int null
    ,fee_earner varchar (10) null
    ,dateclosed datetime null
    ,value decimal null)
    insert into #tmp1 values ('12345','kerry','2013-12-10',9563.54)
    insert into #tmp1 values ('12345','kerry','2013-12-10',null)
    insert into #tmp1 values ('12345','kerry','2013-12-10',null)
    insert into #tmp1 values ('12345','kerry','2013-12-10',null)
    insert into #tmp1 values ('12345','kerry','2013-12-10',null)
    insert into #tmp1 values ('12345','kerry',null,null)
    insert into #tmp1 values ('23456','kerry',null,900.00)
    select matter_ref,fee_earner,dateclosed,value, row_number() over (partition by matter_ref order by value desc) as seq1
    from #tmp1
    drop table #tmp1
    In SSRS I have set a matrix table with fee_earner in the row and value in the data section
    To start I only want to bring back the value in the value column that meets this criteria
    =IIF(not isnothing(Fields!dateclosed.Value) and Fields!seq1.Value = 1,Fields!value.Value,0)
    this bring back the value 9564 which is the value I expect.
    What I want to do is to average this value by how many records meet the above criteria which is one so the average would be 9564
    but when using this =AVG(IIF(not isnothing(Fields!dateclosed.Value) and Fields!seq1.Value = 1,cint(Fields!value.Value),0)) I get 1366
    It seems that it is averaging the 9564 by the 7 records.
    How can I get around this?

    Hi Aivoryuk,
    Thanks for your posting.
    I am glad to hear that you have resolved the issue and share the solution to the forum. It will be benefit for whom have similar issue to solve.
    Regards,
    Heidi Duan
    Heidi Duan
    TechNet Community Support

  • SSRS Report Expressions

    Hi all,
    Please assist with the below:
    I have a report that contains a calculated field. I wish to find the average of a set of values, with the exception of 0 values and values >=14.
    For example, in the below, I'd like the average to be 13.52 (13.60+13.99+12.99+13.50)/4, and not 11.51 (shown below) (13.60+13.99+12.99+14.95+0.00+13.50)/6
    Please assist,
    Many thanks
    Regards
    Zimiso

    Hi Zimiso,
    Use below expression for you avg calculation:-
    =sum(iif(cdbl(Fields!rsp.Value) >=14,0,cdbl(Fields!rsp.Value)))/sum(iif(Fields!rsp.Value<>0,(iif(cdbl(Fields!rsp.Value) >=14.00,0,1)),0))
    You report output look like below:-
    Thanks
    Prasad
    Mark this as Answer if it helps you to proceed on further.

  • SSRS 2008 - Expression for totals in a Matrix

    Hi,
    I have a simple Matrix with the following groups:
    Row Group: Program
    Column Group: Employee
    I need to add a new total column on the right side of the matrix using a simple calculation but I haven't been able to find how to do that other than doing it on the query side. Here's how the Matrix looks like:
    Program
    Employee1
    Employee2
    Employee3
    New Column
    Program1
    45.0%
    0.0%
    87.5%
    Program2
    12.5%
    50.0%
    3.8%
    Program3
    28.8%
    1.3%
    8.7%
    Program4
    1.3%
    23.8%
    0.0%
    Total
    87.6%
    75.1%
    100.0%
    The new column should display the sum of each program divided by the sum of all totals....for example for Program1 the calculation should be (45+0+87.5)/(87.6+75.1+100) which should be equal 50.44% ...the same logic applies for the other
    rows.
    The number of columns (Employees) and rows (Programs) are dynamic, so they change according to who is seeing the report. I'm unable to reference the sum of the total at the bottom row, not sure what I am missing.
    Any input on this is greatly appreciated.

    Hi Cleber,
    I have tested on my local environment and your issue can be caused by you haven't include the scope in the sum function, please find details information below about how to do the calculation:
    Please design the matrix like below:
    You can find the Row Group name is "Program" and the Column Group name is "Empolyee", this will include in the sum expression as below:
    Expression1: =SUM(Fields!Amount.Value,"Empolyee")
    Expression2: =SUM(Fields!Amount.Value,"Program")
    Expression2: =Sum(Fields!Amount.Value,"Program")/Sum(Fields!Amount.Value,"DataSet1")
    Preview you will got the result like below:
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    If you have any feedback on our support, please click
    here.
    Vicky Liu
    TechNet Community Support

  • SSRS Variance expression problem. Create a Variance expression. Compare current month with same month from previous year.

    Hello,
    I am using VS2010 shell.  I have a matrix report where I have a row group by Year.  Then I have a column group by Month. 
    When I run the report, I get 2013 data on top of 2014 data.  Now I need to create a variance by year for each month.
    So in the example below, I need to create an expression that will pull the variance for Oct 01... subtracting 2013 from 2014 for the months.  So I need to Subtract 8,222 - 4290.  I have no clue.
    Here is what my rdl looks like.
    Thank you for your help. 

    Hi Adrian,
    If I understand correctly, you want to calculate the difference order between 2013 and 2014 for every month. And there are only two years in the FISCAL_YEAR field.
    If in this scenario, we can simply use the following expression to achieve your requirement:
    =first(Fields!ORDER.Value)-last(Fields!ORDER.Value)
    The following screenshot is for your reference:
    If there are any misunderstanding, please elaborate the issue for further investigation.
    Regards,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Hiding Entire Row having Null and default valu in SSRS Using Expression

    Hi,
    In my reports having number of rows and three columns.The first columns  value will be different for each and every row and it will be  hard corded to the text box.  My question is how to hide the particular row second and third column suppose
    to be null or empty data and each and every row had Hide is true.Please provide me the solution if anybody known.
    Regards,
    HariKan
    HariKan

    Hi Qiuyun Yn,
    Thanks for your reply.
     If i use Not Null in my query in where
    condition  then i have to add 30 fields in my where condition,  and i guess it will not give proper output why because i have 30 columns.
    So could you please give me in report level solution. I am struggling past 10 days for this issue.
    Regards,
    Hari 
    HariKan

  • Multiple IIF Statements in SSRS Expression

    Team:
    The following IIF expression works:
    =IIf(Fields!Court.Value = "MA", "Total Filed:   Daily = "&Fields!MAFiledDaily.Value, Nothing)&
    IIf(Fields!Court.Value = "MA", " | Monthly = "&Fields!MAFiledTotal.Value, Nothing)
    However; I have 10 additional Court.Values for the IIF statement to check and return results.
    I have tried the following with no luck ("OR" added):
    =IIf(Fields!Court.Value = "MA", "Total Filed:   Daily = "&Fields!MAFiledDaily.Value, Nothing)&
    IIf(Fields!Court.Value = "MA", " | Monthly = "&Fields!MAFiledTotal.Value, Nothing)
    or
    IIf(Fields!Court.Value = "MB", "Total Filed:   Daily = "&Fields!MBFiledDaily.Value, Nothing)&
    IIf(Fields!Court.Value = "MB", " | Monthly = "&Fields!MBFiledTotal.Value, Nothing)
    Any help would be welcomed.
    Regards,
    jer
    jer

    You have to nest the IIf statements which looks a bit messy but the only other way would be to alter your dataset to return the extra text you need with a case statement.
    =IIf(Fields!Court.Value =
    "MA",
    "Total Filed:   Daily = "&Fields!MAFiledDaily.Value, IIf(Fields!Court.Value =
    "MB",
    "Total Filed:   Daily = "&Fields!MBFiledDaily.Value,
    Nothing))&
    IIf(Fields!Court.Value =
    "MA",
    " | Monthly = "&Fields!MAFiledTotal.Value, IIf(Fields!Court.Value =
    "MB",
    " | Monthly = "&Fields!MBFiledTotal.Value,
    Nothing))

  • Partially Bold Text in SSRS 2005 using Expression ?

    Hi,
    I am using SSRS 2005.
    I have one requirment. I need to Partially Bold some part of Text in column.
    Below is the Example.
    Name < - -- Column in SSRS 2005 Report.
    This column contains combination of Last Name and First Name. All Database record contains Last name , while in some record our requirment is to append First Name with that.
    That is i aleady handled using Nested IIF Expression.
    Now, i want to display appended First Name in normal while all Last Name whihc is Database Field in BOLD Font.
    How is it possible ?

    Hi
    I have just saw a possible solution (well done Hentie Stassen!)
    The best solution of course is to upgrade to SQL 2008 reporting services.
    But, if you are stuck with SQL 2005, try the following:
    We know that a possible solution is to have 2 textboxes.  One for name, one for surname.  Then make the surname bold.  This works, but spacing is a big problem as we saw in other examples on this thread.  Here is the solution for the
    spacing problem:
    The idea is to have 1 textbox for the name, with lots of surname textboxes at different positions and only have 1 of these surname textboxes visible. 
    More detail:
    1. The left-most textbox is the Name field.
    2. Then have 10 or more Surname textboxes, with Bold and displaying the Surname field.  All surnames text boxes overlapping each other, but each one starting about 1cm to the right of the previous one.  The first Surname textbox starts about 1cm
    to the right of the leftmost point of the Name textbox, overlapping most of it.
    3. Now set the visibility property of each of the "Surname" textboxes.  All will be hidden by default.  Set the visibility of the 1st "surname" to true only if the lenth of the name field is less than 2.  Set the visibility
    of the 2nd "surname" to true only if the length of name =2, etc.
    Have a happy day
    Andre Maakal

  • IIF In SSRS With Opposite Of = For A List

    I am trying to build a Expression using IIF with the opposite of this in a calculated field:
    =IIF((Fields!DEPARTMENT_CODE.Value = "22700") OR (Fields!DEPARTMENT_CODE.Value = "22800") OR (Fields!DEPARTMENT_CODE.Value = "22900") OR (Fields!DEPARTMENT_CODE.Value = "23000") OR (Fields!DEPARTMENT_CODE.Value = "2350")
    OR (Fields!DEPARTMENT_CODE.Value = "23800") OR (Fields!DEPARTMENT_CODE.Value = "23900") OR (Fields!DEPARTMENT_CODE.Value = "24000") OR (Fields!DEPARTMENT_CODE.Value = "24100") OR (Fields!DEPARTMENT_CODE.Value = "24200")
    OR (Fields!DEPARTMENT_CODE.Value = "24300"),1,0)
    I have tried <>, AND, AND NOT, and XOR which all seem to yield the same results.  Any suggestions would be greatly appreciated!
    Thanks in advance! Brett

    Hi Brett,
    To sum it up, The IIF() statement has the following format:
    =IIF( Expression to evaluate, what-to-do when the expression is true, what-to-do when the expression is false )
    Parameter1: It should be a Boolean expression.
    Paremeter2: This value will return when Expression is true.
    Paremeter3: This value will return when Expression is false.
    So in the Calculated Field 1, we can use the expression below to achieve your requirement:
    =IIF((Fields!DEPARTMENT_CODE.Value = "22700") OR (Fields!DEPARTMENT_CODE.Value = "22800") OR (Fields!DEPARTMENT_CODE.Value = "22900") OR (Fields!DEPARTMENT_CODE.Value = "23000") OR (Fields!DEPARTMENT_CODE.Value = "23500") OR (Fields!DEPARTMENT_CODE.Value =
    "23800") OR (Fields!DEPARTMENT_CODE.Value = "23900") OR (Fields!DEPARTMENT_CODE.Value = "24000") OR (Fields!DEPARTMENT_CODE.Value = "24100") OR (Fields!DEPARTMENT_CODE.Value = "24200") OR (Fields!DEPARTMENT_CODE.Value = "24300"),1,0)
    In the Calculated Field 2, we can use the expression below to achieve your requirement:
    =IIF((Fields!DEPARTMENT_CODE.Value = "22700") OR (Fields!DEPARTMENT_CODE.Value = "22800") OR (Fields!DEPARTMENT_CODE.Value = "22900") OR (Fields!DEPARTMENT_CODE.Value = "23000") OR (Fields!DEPARTMENT_CODE.Value = "23500") OR (Fields!DEPARTMENT_CODE.Value =
    "23800") OR (Fields!DEPARTMENT_CODE.Value = "23900") OR (Fields!DEPARTMENT_CODE.Value = "24000") OR (Fields!DEPARTMENT_CODE.Value = "24100") OR (Fields!DEPARTMENT_CODE.Value = "24200") OR (Fields!DEPARTMENT_CODE.Value = "24300"),0,1)
    If you have any other questions, please feel free to let me know.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Expression Question for SQL Server Reporting Services 2008 R2

    I am trying to form an expression that will give me the est. hours for a specific project type.  Project Type is a field in the data set as well as est.hrs.  There are no calculations needed.  The hours is listed under the field name"Est.Hours".
     So I've been trying to us an IIF expression.  IIF(Fields!ProjectType.Value=Landscaping, "", Fields!Est.Hours.Value).  It is not working.  It renders "0" and it should render "10".  What am I doing wrong?  

    Hi Data Specialist,
    Per my understanding that you want to use the expression to display the Est.Hours for the ProjectType which value are not  "Landscaping" and if the value is "Landscaping" it will display null value, right?
    I have tested on my SSRS 2008 R2 environment and find the issue can be caused by the expression you are using, I would like to confirm with you if the expression "IIF(Fields!ProjectType.Value=Landscaping, "", Fields!Est.Hours.Value)"
    is what you are currently using.
    As Patrick Hurst mentioned that we need do modify the wrap Landscaping in double quotes: "Landscaping" and also the fields name "Est.Hours" also can cause the problem, please try to remove the ".", rename the
    field like"EstHours", So finally the expression is as below:
    =IIF(Fields!ProjectType.Value="Landscaping", "", Fields!EstHours.Value)
    If your problem still exists, please try to provide details information below to help us more effective to provide an solution:
    If you got some error message, please provide them to us.
    Please try to provide the snapshot of the report structure and the sample data of the table
    Any problem, please feel free to ask.
    Regards
    Vicky Liu

Maybe you are looking for