Andrew Burns
Andrew Burns

Reputation: 346

SSRS - Category Groups Expression - Group By Field Null or Not Null

I have a dataset that has 2 fields. Like below:

Change Number | Project Reference

1251554456465 | 5336

2546546546546 |

3216546546466 | 5534

Some values in Project Reference will have null entries.

I want to show a Pie chart that shows 2 categories based on this data: Category 1 - Changes that have a Project Reference Category 2 - Change that have NO Project Reference (ie project reference is null)

I have tried to do an expression in the Category Groups section like below:

=(Fields!projectRef.Value is nothing)

This shows

enter image description here

I think I am halfway there I just need help to finish it off and include the category where the expression results to false as well.

Upvotes: 0

Views: 7281

Answers (2)

Ian Preston
Ian Preston

Reputation: 39586

You were on the right track.

For the Category Group expression, use something like:

=IIf(IsNothing(Fields!projectRef.Value), "Has Project", "No Project")

i.e. use an IIf expression to assign one of two values based on the result of the IsNothing expression, which checks for NULLs.

With your data:

enter image description here

I have a simple Chart:

enter image description here

The value is just a count of items in the category.

I've set Label and Group on to the expression above under the Category Group properties:

enter image description here

Result looks good:

enter image description here

Upvotes: 1

Wombelite
Wombelite

Reputation: 303

Off the top of my head I think its something like system.dbnull.value or system.dbnull that you need to compare to

eg:

=(Fields!projectRef.Value = System.DbNull.Value)

or

=(Fields!projectRef.Value = System.DbNull)

Upvotes: 0

Related Questions