Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CUBESET() function in Excel with Multiple criteria

I'm trying to create a CUBESET function in Excel, but I don't know how to filter it using multiple criteria within the same dimension. This is what I have so far working with one criteria.


Example 1:

=CUBESET("ThisWorkbookDataModel","{[Facebook].[Bucket (C)].[All].[DPA]*[Facebook].[AudienceType (C)].children}","Bucket")

Example 2: with date in cell C3

=CUBESET("ThisWorkbookDataModel","{[Facebook].[Week End].[All].["&TEXT($C$3,"m/d/yyyy")&"]*[Facebook].[Campaign (C)].children}","Campaign Breakout - Weekly")

And this is what I've tried to do with two criteria, but with no luck.

Example 1:

=CUBESET("ThisWorkbookDataModel","FILTER( [Facebook].[AudienceType (C)].children,[Facebook].[Week End].[All].["&TEXT($C$3,"m/d/yyyy")&"] && [Facebook].[Bucket (C)].[All].[DPABroadAudience])","Bucket")

Example 2:

=CUBESET("ThisWorkbookDataModel","FILTER( [Facebook].[AudienceType (C)].children,AND([Facebook].[Week End].[All].["&TEXT($C$3,"m/d/yyyy")&"],[Facebook].[Bucket (C)].[All].[DPABroadAudience]))","Bucket")

Example 3:

=CUBESET("ThisWorkbookDataModel","{[Facebook].[AudienceType (C)].children *[Facebook].[Week End].[All].["&TEXT($C$3,"m/d/yyyy")&"] * [Facebook].[Bucket (C)].[All].[DPABroadAudience]})","Bucket")

Btw - while I only need two criteria right now, it would be great to see a solution that would work for 2+ criteria.

like image 576
Chris Avatar asked Dec 31 '25 13:12

Chris


1 Answers

Please try:

=CUBESET("ThisWorkbookDataModel","EXISTS( [Facebook].[AudienceType (C)].children,([Facebook].[Week End].[All].["&TEXT($C$3,"m/d/yyyy")&"], [Facebook].[Bucket (C)].[All].[DPABroadAudience]) )","Bucket")

Since both filters are in the same Facebook dimension the EXISTS function should work. Feel free to add additional filters from the Facebook dimension.

If you need to filter by other dimensions (not the Facebook dimension) then you will need to do the following. Choose a measure which will determine which AudienceTypes exist with the filters.

=CUBESET("ThisWorkbookDataModel","NONEMPTY( [Facebook].[AudienceType (C)].children,([Measures].[Your Measure], [Facebook].[Week End].[All].["&TEXT($C$3,"m/d/yyyy")&"], [Facebook].[Bucket (C)].[All].[DPABroadAudience], [Other Dimension].[Column Z].[All].[Your Filter]) )","Bucket")
like image 187
GregGalloway Avatar answered Jan 03 '26 12:01

GregGalloway



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!