![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a cube that presents accounts receivable data. It contains 3 measures: Measure 1: The sum of accounts that owe us money Measure 2: The sum of accounts we owe money to Measure 3: The Net (measure1 - measure2) The underlying fact table contains detailed transactions with an "amount" field which is positive when we charge an account and positive when the account pays. I cannot rollup with simple sums. I need to first sum by account and then slot the resulting sum as either Measure 1 or Measure 2 and then sum for Measure 1 and sum for Measure 2. Any ideas on how to do the two stage sum (first by account and then across accounts)? Thanks! -- Bob Hodgman |
#3
| |||
| |||
|
|
I have a cube that presents accounts receivable data. It contains 3 measures: Measure 1: The sum of accounts that owe us money Measure 2: The sum of accounts we owe money to Measure 3: The Net (measure1 - measure2) The underlying fact table contains detailed transactions with an "amount" field which is positive when we charge an account and positive when the account pays. I cannot rollup with simple sums. I need to first sum by account and then slot the resulting sum as either Measure 1 or Measure 2 and then sum for Measure 1 and sum for Measure 2. Any ideas on how to do the two stage sum (first by account and then across accounts)? Thanks! -- Bob Hodgman |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
Hi Bob, It's not clear why a "two-stage sum" is required - if you could illustrate with some sample data, that would be helpful. In terms of Measure1 and Measure2, if you're using AS 2005 you could create 2 Named Calculations for the fact table like: [AmountToGet]: case when amount > 0 then amount else 0 end [AmountToPay]: case when amount < 0 then -amount else 0 end Then create Measure1 from [AmountToGet] and Measure2 from [AmountToPay], both measures with "Sum" aggregation. With AS 2000, the above expressions can be configured as the "Source Column" property of the respective measure. - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#6
| |||
| |||
|
#7
| |||
| |||
|
|
Hi Bob, I didn't get your arithmetic for the aggregation numbers, but did the suggestions I made for Measure1 and Measure2 help? If the results from these measures still aren't what you want, maybe you can provide a few examples fo what they return, versus what you expect. - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
#8
| |||
| |||
|
|
I have a cube that presents accounts receivable data. It contains 3 measures: Measure 1: The sum of accounts that owe us money Measure 2: The sum of accounts we owe money to Measure 3: The Net (measure1 - measure2) The underlying fact table contains detailed transactions with an "amount" field which is positive when we charge an account and positive when the account pays. I cannot rollup with simple sums. I need to first sum by account and then slot the resulting sum as either Measure 1 or Measure 2 and then sum for Measure 1 and sum for Measure 2. Any ideas on how to do the two stage sum (first by account and then across accounts)? Thanks! -- Bob Hodgman |
#9
| |||
| |||
|
|
Hi Bob, I didn't get your arithmetic for the aggregation numbers, but did the suggestions I made for Measure1 and Measure2 help? If the results from these measures still aren't what you want, maybe you can provide a few examples fo what they return, versus what you expect. - Deepak Deepak Puri Microsoft MVP - SQL Server *** Sent via Developersdex http://www.developersdex.com *** |
![]() |
| Thread Tools | |
| Display Modes | |
| |