简体   繁体   中英

SSAS Calculated Member

I have a cube with a measure called FactSales, which has entries for each day.

I have three Dimensions, Date, Customer and CustomerType.

Each FactSales row is linked to a date and customer by foreign key. customer is linked to customer type by foreign key.

From this I am able to spit out all sales figure for each customer on each date which is great.

I have multiple types : typeA, typeB, typeC, typeD, typeE.

What I want though is to create two calculated members which have the values aggregated for each customer by typeA, and then by everyother type.

What I have at the moment is something like

 Case
    When IsEmpty( [Measures].[FactSales] ) or [Customer].[CustomerType].currentmember <> [Customer].[CustomerType].&[typeA]
    Then null
    ELSE ([Customer].[CustomerType].&[typeA], [Measures].[FactSales] )
END

but I think this is wrong, and i also can't use this same method to get the value of all the other types excluding the typeA. I also dont get the aggregation when i roll it up to a higher level.

Can anyone help? I may not have explained my self well enough so please let me know if you need more info.

Why you are trying to do that? It's not good to store any calculation that is not related to single fact, data in fact table row should correspond only to one system fact (order, job, etc), and with aggregation you will be able to get data based on any dimension. Your current structure is well and you can easily get calculations by slicing the cube over customer type dimension.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM