简体   繁体   中英

SSAS partition slice based on calculated dimension member

I have an SSAS cube where data is partitioned by current year, last year, and prior to last year. I'd like to set the partition slice property on the partitions, but I'm having trouble getting it to process correctly.

After looking at SSAS Partition Slice Expression , I defined a calculated member [Date].[Year].[All].[CurrentYear] , and used that as my slice expression. It's defined as:

StrToMember("[Date].[Year].&[" + Format(now(), "yyyy") + "]")

When I process the cube, it fails with an error, "The restrictions imposed on the partition slice were violated." I've checked that the query that builds the slice is correct, and it works when I use a slice expression of [Date].[Year].&[2019] .

Is there something incorrect I'm doing here, or is what I'm trying to do impossible?

SSAS partition slice expression is quite restrictive. You cannot use dynamic MDX functions; moreover, you cannot specify infinite ranges like {NULL:[Date].[Calendar].[Dec, 2008]} . You have to specify slice expression explicitly, enumerating all its members if needed.
MS Documentation is not complete, unfortunately. I would check whether do you really need a slice; SSAS itself does a pretty good job autodetecting slices on processing.
Another possible approach - define static dimension member on mentioned hierarchy, and use it in partition slice expression. Using the same hierarchy is important.

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