Quantcast
Channel: SQL Server Analysis Services Forum
Viewing all articles
Browse latest Browse all 2472

Calculated measure in last X days

$
0
0

Hi all,



I'm trying to create measure that will aggregate calculated measure over last x days (can be any number).

On the axis 1 I have the dates . I can't use the sum function cause it's a percent measure. I also cannot do sum separately for the numerator and denominator because I need to implement this measure over complex measures that I don't always know how they are constructed.



I tried to do the following measures:


with 
member [Measures].[avg sale] as
[Measures].[Internet Sales Amount]/[Measures].[Internet Order Quantity]
member [Date].[Calendar].[last 7 days] as
AGGREGATE(LASTPERIODS (7,[Date].[Calendar].CURRENTMEMBER))
MEMBER [Measures].[avg sale over last 7 days] as
([avg sale],[Date].[Calendar].[last 7 days])

select {[avg sale],[Measures].[avg sale over last 7 days]} on 0,
    [

Date].[Calendar].[Date] on 1
from [Adventure Works]


I keep getting null in the result, it's seems like the aggregate cannot evaluate the currentMember function.



does anyone have an idea how to overcome this?



Thanks,

Liran

 

Viewing all articles
Browse latest Browse all 2472

Trending Articles