Filtering a cubeset function by date

cmgish

New Member
Joined
Feb 15, 2021
Messages
10
Office Version
  1. 365
Platform
  1. Windows
I have an Excel model with a single table for which I need to create a cubeset. I have a [Date] column and a [Team] column with many other columns of statistics. What I want to do is create a cubeset based on the date. My table is named Team_Stats, and looks like this:
1741749410775.png

I was hoping to be able to use the cubeset function to create one cubeset based on the date "11/4/2024", and another cubeset based on the date "11/6/2024". I have tried using the FILTER function nested within the CUBESET function, but I'm sure I'm getting the syntax wrong. Can anyone help? The goal of creating the cubesets is to use the CUBERANKEDMEMBER function to pull the top 3 teams or top 5 teams of any one statistic based on the date. Thanks to anyone that can help!
Chris
 
You could use something like this (assumes a date in A2):

Excel Formula:
=LET(dt,TEXT(A2,"yyyy-mm-dd"),CUBESET("ThisWorkbookDataModel","([Team_Stats].[Date].&["&dt&"T00:00:00],[Team_Stats].[Team].children)","Cubeset for "&dt))
 
Upvote 0
Thanks so much RoryA! That formula did filter my cubeset the way I wanted it. However, for some reason I can't get my CUBERANKEDMEMBER function to work. Not really sure what I'm doing wrong. I copied the function you wrote and then added the parameters to sort the CUBESET in descending order, and then to sort by [Team_Stats].[FG%]. So now, the formula looks like this:
Excel Formula:
=LET(dt,TEXT(A2,"yyyy-mm-dd"),CUBESET("ThisWorkbookDataModel","([Team_Stats].[Date].&["&dt&"T00:00:00],[Team_Stats].[Team].children)","Cubeset for "&dt,2,"[Team_Stats].[FG%]"))
I then write my CUBEMEMBER function as:
Excel Formula:
=CUBEMEMBER("ThisWorkbookDataModel","[Team_Stats].[TRB]","Rebounds")
Now, my CUBERANKEDMEMBER function looks like this:
Excel Formula:
=CUBERANKEDMEMBER("ThisWorkbookDataModel",$Z$656,$AB658)
Z656 holds the CUBESET and AB658 holds the CUBEMEMBER function above. I do get a list of team names (which is what I'm going for), but the results are incorrect. It lists the team names in alphabetical order, so the cubeset is sorted by the team name rather than by the statistic I want
 
Upvote 0
I don't follow - why are you passing a cube member as the third argument to CUBERANKMEMBER? It should be a rank number. If you are trying to sort the results by different statistics, it doesn't make sense to sort the original cube set. You could simply get the set for the date:

Excel Formula:
=LET(dt,TEXT(A2,"yyyy-mm-dd"),CUBESET("ThisWorkbookDataModel","([Team_Stats].[Date].&["&dt&"T00:00:00],[Team_Stats].[Team].children)","Cubeset for "&dt)

then adjust that to sort by whatever metric you want:

Excel Formula:
=CUBESET("ThisWorkbookDataModel",Z656,2,"[Team_Stats].[FG%]")
or
Excel Formula:
=CUBESET("ThisWorkbookDataModel",Z656,2,"[Team_Stats].[TRB]")

and then use CUBERANKEDMEMBER on whichever of those sets you want.
 
Last edited:
Upvote 0

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?

Disable AdBlock

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
Back
Top