SAP Knowledge Base Article - Public

2715521 - Using Calculated Columns Conditional Statements for Filtering records - Advanced Reporting


The report requires certain conditions for filtering report results that is not possible to be defined in the Filter Designer/Manage Filter screen.  How can we apply If/Then/Else logic to the report query filters?

For example:
If the Eligibility Indicator = No, then the employee should only have Base Salary as a Pay Component.  If other Pay Components exist, then include this employee record in the report.

If the Eligibility Indicator = Yes, then the employee should have another Pay Component listed other than Base Salary.  If the employee does not have any other pay components listed, then include the record in the report.


SAP SuccessFactors Workforce Analytics


Using the given example, you can apply this logic by using the following functions:

1. Calculated Column field that uses Conditional Statements that will will be used as a check (e.g. name it Field_Check)
2. Duplicating an Advanced Reporting object
3. Adding a Report Filter for the Field_Check field.

It really depends on the report requirements, but looking at the above example you can try doing the following:

1. Since the report will need to check the existence of the appropriate Pay Components, you need at least two (2) Pay Component objects in the report - one will be filtered on Pay Component = Base Salary and the other Pay Component != Base Salary.  This will be used in the calculated column filter conditions.
To duplicate an object: Go to the Objects tab in Advanced Reporting > Expand the object column listing > Click the Duplicate Table icon at the top.

2. After duplicating the relevant object, click on Calculated Columns.

3. Name your calculated column and choose Data Type = Text.  Design your conditional statement using the given logic.  The value of this Field_Check will be used in determining whether to include the record in the report result or not.
e.g. If (Eligible Indicator(External Code) == N AND Pay Component (Label)(2) == [null])) THEN
       Value = 0
       Else If(etc...)
           Value = 1
and so on...

4. After defining the Field_Check, add a Filter to the report by clicking on Manage Filters.  E.g. "Field_Check=1" to exclude certain records from the query result based on the given requirement.

Note: This is just a suggestion and the application of the reporting functions may vary based on your report requirement.
Please note that questions/scenarios like this typically fall under Consulting, so if you require help in deciding how to design your report we recommend enlisting consulting help rather than submitting a ticket to Cloud Support.

See Also

2466134 - Support Scope for Consulting questions and Creation of Reports, Tiles and Dashboards - SuccessFactors Workforce Analytics

2706322 - What is Support – What is Consulting: Cloud Solutions


conditional statements as filters, if then else statements, advanced reporting calculated columns, field checks, filtering report using conditional logic , KBA , LOD-SF-ANA-ORD , Online Report Designer , How To


SAP SuccessFactors HCM Core 1808