Reputation: 97
I have a tablix and hierarchical grouping in the tablix.
For example:
Gender------%count
Female------ 10
Male ------- 0
My query returns all records with Female since there are no records with Male it returns nothing For Male.
In the report I want to show Male as 0 but I am not able to... How do I solve this issue?
Upvotes: 0
Views: 1027
Reputation: 39566
There are typically two options in this situation.
Report Level
Instead of having dynamic group header rows or detail rows, you create a table with three table header rows - one for the column headers and one each for Male
and Female
.
Then you can fill the row values with appropriate conditional expressions, e.g. for Male
row total use something like:
=Sum(IIf(Fields!Gender.Value = "Male", 1, 0)
This will give you 0
instead of Nothing
even if there are no Male
values in the Dataset.
Database level
The other option is to change the Dataset to always return an aggregated row for each gender, i.e. if you're getting the data from a T-SQL query you'd use something like:
select * from
(
select Gender = 'Male'
union
select Gender = 'Female'
) Gender
as the base table (typically you won't have a Gender
table, hence the query above) and LEFT JOIN
it to all the required value data, i.e. always returning each gender row even if no values exist. This way you could still normal group/detail rows to display the data.
Upvotes: 1