# Slicer Time Dimension Issue with Cube Functions

#### Rickfr

##### New Member
Hi,

Hoping someone can help me figure out right approach here.

Summary:
Using Excel 2013 connected to a SSAS cube as data source, and cube functions with slicers to create a dashboard.
Have following time dimension slicers; Fiscal Year, Fiscal Quarter, Fiscal Month, Fiscal Week & Date, that are used to slice data based on user selection, along with a sales measure.
Below is example of Slicer name and CubeMember function for each:

Slicer_Fiscal_Year: =CUBEMEMBER("Cube","[Date].[Fiscal Year].&[2015]")
Slicer_Fiscal_Quarter: =CUBEMEMBER("Cube","[Date].[Fiscal Quarter].[All]")
Slicer_Fiscal_Month: =CUBEMEMBER("Cube","[Date].[Fiscal Month].&[201408]")
Slicer_Fiscal_Week: =CUBEMEMBER("Cube","[Date].[Fiscal Week].&[201509]")
Slicer_Date: =CUBEMEMBER("Cube","[Date].[Date].[All]")

Problem:
What I am trying to do is to build a table that takes the lowest grain of the slicer time dimension selected, shows the current member, plus the prior 7 so I can have an 8 period trending view table that I will build a chart from. In the above example that would mean that it would look at Slicer_Fiscal_Week since that is lowest grain that has an attribute other than All, and then show me the prior 7 periods. In this case 201509 means Week 9, so I would want to show in table Week 9 back to Week 2. But if Slicer_Fiscal_Week was set to All, along with Slicer_Date, then Fiscal Month would be lowest grain, so I would want to show Fiscal Months from August (201408) back to January 2014. I know how to use CubeRankedMember to pull the value from what is selected in the slicer, the problem is figuring out how to pass the lowest grain time dimension so that I can use lag or some other MDX function to get the previous periods.

Any help on this would be greatly appreciated.

### Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
I see two possible solutions

1) have a look a the dynamic charting method
Dynamic Charting In Power Pivot « PowerPivotPro

2) Excel workaround

build a 8-column-table with all periods (dates,weeks,month... all in one list) and the related period -7, -6- ...

Use CUBERANKEDMEMBER to find out what is selected and on what level you are. You need to get the member from the lowest level that does not show "all" in one cell.
In my Cube Year, Quarter, Month are in one hierarchy so even that I see 3 slicer its only one slicer_period behind and CUBERANKEDMEMBER exactly shows me that member (e.g. FY15 Q1 if Q1 is selected and Month is on All).
In your case slicer seem to be independend and you would need some If statements to find out on what level you are --> IF(CUBERANKEDMEMBER("Cube",Slicer_Date;1)<>"All";CUBERANKEDMEMBER("Cube",Slicer_Date;1); IF(CUBERANKEDMEMBER("Cube",Slicer_Week;1)<>"All";......

Now create a VLOOKUP to your period table to pull the members for period -1 to period - 7 that you can use for your CUBEVALUE formulas

Replies
7
Views
1K
Replies
0
Views
922
Replies
0
Views
709
Replies
3
Views
1K
Replies
10
Views
2K

1,217,500
Messages
6,137,008
Members
450,038
Latest member

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

### Which adblocker are you using?

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

### Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back