CUBESET TopCount problem with date range

macfuller

Active Member
Joined
Apr 30, 2014
Messages
319
Office Version
  1. 365
Platform
  1. Windows
I am getting inconsistent results with the following CUBESET statement.
- returns the correct ranked values without the date range clause
- returns the correct ranked values when the start and end date are the same (taken from a timeline)
- returns out of order and duplicate values when start and end date are not the same.

=CUBESET("ThisWorkbookDataModel","TopCount(
(
[CC Detail].[Dept Category].[" & G14 & "],
[Account Tree].[Node 7 Descr].[" & $K$2 & "],
[CC Detail].[Facility].[" & $K$3 & "],
[Orders].[Origin].[" & $K$4 &"],
[Calendar].[Date].[" & $K$5 & "]:[Calendar].[Date].[" & $K$6 & "]",
[Vouchers].[Vendor Name].children
)
,10
,[Measures].[Voucher Amt]
)","Vendors for " & G14
)

Values are returned from the cubeset using CUBERANKEDMEMBER 1-10. Here are results from a 3 day range (amount retrieved in a separate column)

Vendor1 $7,630
Vendor2 $5,090
Vendor3 $3,629
Vendor4 $5,573
Vendor5 $3,680
Vendor6 $3,395
Vendor7 $6,809
Vendor8 $3,307
Vendor7 $6,809
Vendor9 $3,075

<tbody>
</tbody><colgroup><col><col></colgroup>


I wish to return the top 10 vendors, based on voucher spend, for particular departments, General Ledger accounts, Locations, and Purchase Order types. The cells in each reference area contain the CUBERANKEDMEMBER of the respective slicers.

The file is extremely large and contains proprietary data so I can't post it unfortunately.

The calendar table and respective lookup tables have a relationship with the Purchase Order [Orders] table, which in turn has a relationship with the [Vouchers] table where the measure is taken from. The calendar file is marked as a date table and has all dates between any two points on the timeline.

I've tried adding .[All] to the date clause and a few other options but nothing seems to eliminate the inconsistent results. There is a similar question on Stack Overflow that I added a question to but the original question has had no response in several months. I'm hoping there's a simple syntax issue with the date clause.
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
I believe the "correct" syntax for "children" is

[Orders].[Origin].&[Child]

You don't have the ampersand. Try adding that back in and see if it manages the consistency issue. In my experience it "can" work without it, but I think this is the "better" syntax
 
Upvote 0
Did you mean for vouchers? That's the only clause with .children. I tried your syntax but the cell returned #N/A.
 
Upvote 0
I don't think you can use .children at all (I could be wrong). I am not an expert but thought that this may be the problem. The & syntax is to extract a single child from the model, and you need to specify the exact value in place where I put 'child'. But I guess that is not going to do what you want - sorry.
 
Upvote 0
The syntax works fine with no date clause for all other variables. I check against a normal pivot table. It's only the date clause that introduces the variance. If I knew a way to have <= a date I'd try with just one date condition and see if it returns something to match the pivot table.
 
Upvote 0
I am getting inconsistent results with the following CUBESET statement.
- returns the correct ranked values without the date range clause
- returns the correct ranked values when the start and end date are the same (taken from a timeline)
- returns out of order and duplicate values when start and end date are not the same.

=CUBESET("ThisWorkbookDataModel","TopCount(
(
[CC Detail].[Dept Category].[" & G14 & "],
[Account Tree].[Node 7 Descr].[" & $K$2 & "],
[CC Detail].[Facility].[" & $K$3 & "],
[Orders].[Origin].[" & $K$4 &"],
[Calendar].[Date].[" & $K$5 & "]:[Calendar].[Date].[" & $K$6 & "]",
[Vouchers].[Vendor Name].children
)
,10
,[Measures].[Voucher Amt]
)","Vendors for " & G14
)

Values are returned from the cubeset using CUBERANKEDMEMBER 1-10. Here are results from a 3 day range (amount retrieved in a separate column)

Vendor1 $7,630
Vendor2 $5,090
Vendor3 $3,629
Vendor4 $5,573
Vendor5 $3,680
Vendor6 $3,395
Vendor7 $6,809
Vendor8 $3,307
Vendor7 $6,809
Vendor9 $3,075

<tbody>
</tbody>


I wish to return the top 10 vendors, based on voucher spend, for particular departments, General Ledger accounts, Locations, and Purchase Order types. The cells in each reference area contain the CUBERANKEDMEMBER of the respective slicers.

The file is extremely large and contains proprietary data so I can't post it unfortunately.

The calendar table and respective lookup tables have a relationship with the Purchase Order [Orders] table, which in turn has a relationship with the [Vouchers] table where the measure is taken from. The calendar file is marked as a date table and has all dates between any two points on the timeline.

I've tried adding .[All] to the date clause and a few other options but nothing seems to eliminate the inconsistent results. There is a similar question on Stack Overflow that I added a question to but the original question has had no response in several months. I'm hoping there's a simple syntax issue with the date clause.

Hi,
i have the same problem, did you solve it?
 
Upvote 0
Upvote 0
It is doesn't do what you want, that doesn't automatically make it a bug. Maybe it is just not designed to do what you want.
 
Upvote 0

Forum statistics

Threads
1,214,429
Messages
6,119,433
Members
448,897
Latest member
ksjohnson1970

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