Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Analysis Server and Reporting Services (2012)
 Exclude the blank value total in grand total?

Author  Topic 

learntsql

524 Posts

Posted - 2014-08-22 : 03:05:11
Hi All,

how to exclude the blank values total in grand total.

for example i have two attribites coming for hierarchy like below.

Blank --> 10
Current date --> 20

if the values are like above when drag them into browser grand total is displaying as 30 which is correct. but my requirement is to hide the blank value in browser and should show the only valid values (current date).this i can achive by setting the Hirarchy member property.

after hiding it now my final result is showing like below.

Current date --> 20
Grnad Total --> 30 (which should be 20).

Can some one guide me how to exclude the blank values sum in grand toatal.

Many Thanks in advance!!

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2014-08-22 : 13:59:17
Depends on how you are calculating the grand total now. Assuming you have an expression somewhere in query which is like:
SUM(SomeColumn) as GrandTotal
You would change that to
SUM(CASE WHEN YourColumnThatHasBlanks = '' THEN 0 ELSE SomeColumn END) as GrandTotal
This only a template for you to do what you need to do. Whether you check for empty strings ('') or NULL, or something else depends on your data type and data stored in blank rows for that column.
Go to Top of Page
   

- Advertisement -