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 2005 Forums
 Analysis Server and Reporting Services (2005)
 Conditional Calculated Column for my Cube

Author  Topic 

Tomco21
Starting Member

6 Posts

Posted - 2011-01-04 : 18:51:40
Hi, thanks to everyone who looks at this, this has puzzled me for a week now and i haven't been able to find a solution. I'm fairly new to cube design so please bear with me.

I have the data...

Group | Class | Amount
---------------------------
Group A | Class 1 | 3000
Group A | Class 1 | 4000
Group A | Class 2 | 2000
Group A | Class 2 | -3000

I want to create a conditional calculation on the Amount column based on the sum of the previous level, so if the sum => 0 then output Amount otherwise output 0.

For example if i drop Group in as the dimension and CalculatedAmount as the measure, the sum of Amount = 6000 so CalculatedAmount will be left as 6000. If however i drop a hierarchy of Group -> Class as the dimension and CalculatedAmount as the measure Class 1 will be given the CalculatedAmount of 7000, Class 2 will be given the CalculatedAmount of 0.

Is this possible? Does this make sense? As i say i am fairly new to this so i may be going about it completely the wrong way, any hints or advice would be greatly welcomed.

Thanks,
Tomco

Tomco21
Starting Member

6 Posts

Posted - 2011-01-04 : 19:29:11
I've realised the data set i've provided doesnt really explain what i am trying to do, using the example above i understand i could just write a simple IF on Amount and return the sum or return 0. So please imagine if you will the following dataset...

Child | Group | Class | Amount
-------------------------------------
Steven | Group A | Class 1 | 3000
Dan | Group B | Class 1 | 4000
Grace | Group A | Class 2 | 2000
Jane | Group B | Class 2 | -3000

When i browse on Group -> Child the output will be like...
Group A 5000
- Steven 3000
- Grace 2000
Group B 1000
- Dan 4000
- Jane -3000

But when i browse on Class -> Child the output would be like...

Class 1 7000
- Steven 3000
- Dan 4000
Class 2 -1000
- Grace 0
- Jane 0
Go to Top of Page
   

- Advertisement -