Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fact Table field Split into separate Calculated fields??

Status
Not open for further replies.

bbrendan

IS-IT--Management
Dec 13, 2001
109
GB
HI All,

I have a fact table which contacts one field called QTY. This field contacts both credits and debits like

ISBN QTY
12344 1
12344 -5
12344 10
12344 -2
12344 1

How can I create a measure or a calculated member of this to break it out into two columns like

ISBN Debit Credit
12344 1 0
12344 0 -5
12344 10 0
12344 0 -2
12344 1 0

thanks
 
Do it in the database with a view, much better from a performance point of view.

Stick to your guns
 
A view with something like the folowing

Code:
Select
ISBN
Debit = CASE WHEN QTY <= 0 Then 0 Else QTY End,
Credit = CASE WHEN QTY >= 0 Then 0 Else QTY End,
From MyTable

Another option would be to make the distinction when you populate the table. I would rather eat a few seconds on populating a table than the over head than the case statement in a view.

Shoot Me! Shoot Me NOW!!!
- Daffy Duck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top