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.
Author |
Topic |
bbrendan
Starting Member
3 Posts |
Posted - 2004-10-22 : 11:23:10
|
HI All,I have a fact table which contacts one field called QTY. This field contacts both credits and debits likeISBN QTY12344 112344 -512344 1012344 -212344 1How can I create a measure or a calculated member of this to break it out into two columns likeISBN Debit Credit12344 1 012344 0 -512344 10 012344 0 -2 12344 1 0thanks |
|
Kristen
Test
22859 Posts |
Posted - 2004-10-23 : 00:03:10
|
[code]SELECT ISBN, [Debit] = CASE WHEN QTY > 0 THEN QTY ELSE 0 END, [Credit] = CASE WHEN QTY < 0 THEN QTY ELSE 0 ENDFROM Mytable[/code]In similar fashion you coudl make a VIEW onto the table with these extra "calcuated" columns; or you could add a couple of Computed Columns to the table (but in my experience Computed Columns in a table have been Bad News, and I would strongly caution against them)Kristen |
|
|
|
|
|