Skip to main content
Post a question

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id : z+Z9Z8dAXLuuNYPsg8ZfU4

How to show default value or first value for the field which is not part of group and returning more than one values

Vijay Yelmame VY Profile Picture Vijay Yelmame VY 468
Grouping Data by Certain Fields and Handling Cases Where a Specific Field Returns More Than One Value in D365FO SSRS Reports

Grouping Data by Certain Fields and Handling Cases Where a Specific Field Returns More Than One Value in D365FO SSRS Reports

When working with SQL Server Reporting Services (SSRS) in Dynamics 365 Finance and Operations (D365FO), you might encounter scenarios where you need to group data by certain fields and handle cases where a specific field, not part of the group, returns more than one value. In this blog post, we'll explore how to manage such scenarios by conditionally displaying default values for that field.

Scenario

Consider a report with the following fields:

  • Field 1
  • Field 2
  • Field 3
  • Field 4

We want to group the data by certain fields: Field 2, Field 3, and Field 4. However, if a specific Field 1 that is not part of the group returns more than one value, in that case we want to display a default value, such as a blank or "Unknown".

Solution

To achieve this, we can use an SSRS expression to check if there are multiple values for the specific field within the group and conditionally display a default value.

Expression for Blank Default Value

=IIF(CountDistinct(Fields!Field1.Value, "YourGroupName") > 1, "", Fields!Field1.Value)

Expression for "Unknown" Default Value

=IIF(CountDistinct(Fields!Field1.Value, "YourGroupName") > 1, "Unknown", Fields!Field1.Value)

Expression for FirstValue

=First(Fields!Field1.Value, "YourGroupName")

Conclusion

By using these approaches, you can effectively manage the display of specific fields in your D365FO SSRS reports when dealing with multiple values within a group, ensuring that your report remains clear and easy to read.

We hope this solution helps you in your D365FO SSRS reporting tasks. If you have any questions or need further assistance, feel free to reach out!


This was originally posted here.

Comments

*This post is locked for comments