SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


adding columns


adding columns

Author
Message
astrid 69000
astrid 69000
SSC-Addicted
SSC-Addicted (460 reputation)SSC-Addicted (460 reputation)SSC-Addicted (460 reputation)SSC-Addicted (460 reputation)SSC-Addicted (460 reputation)SSC-Addicted (460 reputation)SSC-Addicted (460 reputation)SSC-Addicted (460 reputation)

Group: General Forum Members
Points: 460 Visits: 200
hi,

i have an mxd query that returns the data for yesterday (dynamic). what do i need to do to return the data from the day before yesterday in the second column and make a third column with an avg calculation of the first and second column.

here is my code.

with
member [Measures].[Max] As max({[Hour Dim].[D Hour].[All].children},[Measures].[Purchase - converted to USD])
member [Measures].[Min] As min({[Hour Dim].[D Hour].[All].children},[Measures].[Purchase - converted to USD])
member [Measures].[Avg] As avg({[Hour Dim].[D Hour].[All].children},[Measures].[Purchase - converted to USD])
member [Measures].[Void] As Aggregate(
CROSSJOIN({strToMember("[CHB Date].[Year - Month - Period - Date].[Date].&[" + Format(dateadd("d",now(),-1), "yyyy-MM-ddT00:00:00") +"]") },
{ [Chargebacks].[CHB_Tree].[CHB Type].&[IRS VOID] }), [Measures].[Purchase - converted to USD])
member [Measures].[CHB] As Aggregate(
CROSSJOIN({strToMember("[CHB Date].[Year - Month - Period - Date].[Date].&[" + Format(dateadd("d",now(),-1), "yyyy-MM-ddT00:00:00") +"]") },
{[Chargebacks].[CHB_Tree].[CHB Group].&[VOID],[Chargebacks].[CHB_Tree].[CHB Group].&[REFUND],[Chargebacks].[CHB_Tree].[CHB Group].&[ChargeBack]}), [Measures].[Purchase - converted to USD])
select
strToMember("[Time].[Year - Month - Period - Date].[Date].&[" + Format(dateadd("d",now(),-1), "yyyy-MM-ddT00:00:00") +"]") on columns,
{[Measures].[Purchase - converted to USD],
[Measures].[Purchases_Count],
[Measures].[Site Pay User],
[Measures].[Free_signups],
[Measures].[free to site pay user],
[Measures].[click to site pay user],
[Measures].[Click Count],
[Measures].[Guests Logins Count],
[Measures].[Guests Unique Logged in],
[Measures].[Guests Credit Spent],
[Measures].[Max],
[Measures].[Min],
[Measures].[Avg],
[Measures].[Void],
[Measures].[CHB] } on rows
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search