dbTalk Databases Forums  

Calculation based on previous member HELP

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Calculation based on previous member HELP in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
daveoram24@hotmail.com
 
Posts: n/a

Default Calculation based on previous member HELP - 10-30-2006 , 08:45 AM






Hi Everyone,
A sql Newbie here about to go nuts...

Ive been reading a lot of postings on the CurrentMemeber, PrevMember
functions but am unable to get them working.
Heres my problem.
In a table i have values based on an ID column, however there are some
IDs that have multiple rows..example below.
TABLE:
ID MarketValue
01 10000
01 20000
02 25000
03 15000
02 40000
Want it to look like:
ID MarketValue
01 30000
02 65000
03 15000

Now i was wondering how i can create a column either in this table, or
in a named query, which gives the total marketValue of each ID. Ive
been trying to use the PrevMember Function to compare if the
CurrentMemberID=PrevMemberID then if it does add the market values...

Any help is appriciated


Reply With Quote
  #2  
Old   
Buelli@gmail.com
 
Posts: n/a

Default Re: Calculation based on previous member HELP - 10-31-2006 , 05:56 AM







Hi,

You have to use a query or view:

SELET ID, SUM (MarketValue) as MarketValue
FROM YourTable
GROUP BY ID

That's it

Greets

Buelli

daveoram24 (AT) hotmail (DOT) com schrieb:

Quote:
Hi Everyone,
A sql Newbie here about to go nuts...

Ive been reading a lot of postings on the CurrentMemeber, PrevMember
functions but am unable to get them working.
Heres my problem.
In a table i have values based on an ID column, however there are some
IDs that have multiple rows..example below.
TABLE:
ID MarketValue
01 10000
01 20000
02 25000
03 15000
02 40000
Want it to look like:
ID MarketValue
01 30000
02 65000
03 15000

Now i was wondering how i can create a column either in this table, or
in a named query, which gives the total marketValue of each ID. Ive
been trying to use the PrevMember Function to compare if the
CurrentMemberID=PrevMemberID then if it does add the market values...

Any help is appriciated


Reply With Quote
  #3  
Old   
daveoram24@hotmail.com
 
Posts: n/a

Default Re: Calculation based on previous member HELP - 10-31-2006 , 08:02 AM



Hey Thanks,

Thats a lot easier than what I was trying.

Cheers,


Buelli (AT) gmail (DOT) com wrote:
Quote:
Hi,

You have to use a query or view:

SELET ID, SUM (MarketValue) as MarketValue
FROM YourTable
GROUP BY ID

That's it

Greets

Buelli

daveoram24 (AT) hotmail (DOT) com schrieb:

Hi Everyone,
A sql Newbie here about to go nuts...

Ive been reading a lot of postings on the CurrentMemeber, PrevMember
functions but am unable to get them working.
Heres my problem.
In a table i have values based on an ID column, however there are some
IDs that have multiple rows..example below.
TABLE:
ID MarketValue
01 10000
01 20000
02 25000
03 15000
02 40000
Want it to look like:
ID MarketValue
01 30000
02 65000
03 15000

Now i was wondering how i can create a column either in this table, or
in a named query, which gives the total marketValue of each ID. Ive
been trying to use the PrevMember Function to compare if the
CurrentMemberID=PrevMemberID then if it does add the market values...

Any help is appriciated


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.