I'm a relative newbie, so excuse the ignorance! To meet end user requirements, I have a list of products and have created the following query to build a dynamic subset based upon two product attributes:
({
FILTER(
{TM1SUBSETALL( [dimProducts] )},
(
([dimProducts].[ProductLine] = [dimProductLine].[ProductLine])
AND
([dimProducts].[Category] = [dimProductCategory].[Category] )
)
)
})
However, while the query works fine showing only relevant products when in the cube, I would like to also have it show 'Total Products' as a part of the subset, where 'Total Products' is of course the aggregation of all products.
If anyone can point me in the right direction, it would be much appreciated.
Mike
Help with dynamic subset
-
- MVP
- Posts: 3704
- Joined: Fri Mar 13, 2009 11:14 am
- OLAP Product: TableManager1
- Version: PA 2.0.x
- Excel Version: Office 365
- Location: Switzerland
Re: Help with dynamic subset
Taking for granted that you say your existing MDX works to filter your products you could do either of the following. If you want Total Products after the list not before then just change the order.
OR
OR
Code: Select all
{
[dimProducts].[Total Products],
{FILTER(
{TM1SUBSETALL( [dimProducts] )},
(([dimProducts].[ProductLine] = [dimProductLine].[ProductLine])
AND
([dimProducts].[Category] = [dimProductCategory].[Category] ))
)}
}
Code: Select all
{[dimProducts].[Total Products]}
+
{FILTER(
{TM1SUBSETALL( [dimProducts] )},
(([dimProducts].[ProductLine] = [dimProductLine].[ProductLine])
AND
([dimProducts].[Category] = [dimProductCategory].[Category] ))
)}
Code: Select all
{UNION(
{[dimProducts].[Total Products]},
{FILTER(
{TM1SUBSETALL( [dimProducts] )},
(([dimProducts].[ProductLine] = [dimProductLine].[ProductLine])
AND
([dimProducts].[Category] = [dimProductCategory].[Category] ))
)}
)}
-
- MVP
- Posts: 2836
- Joined: Tue Feb 16, 2010 2:39 pm
- OLAP Product: TM1, Palo
- Version: Beginning of time thru 10.2
- Excel Version: 2003-2007-2010-2013
- Location: Atlanta, GA
- Contact:
Re: Help with dynamic subset
Just add this to the front of your MDX:
{[dimProducts].[Total Products]} +
{[dimProducts].[Total Products]} +
-
- Posts: 46
- Joined: Fri Jun 15, 2012 1:46 pm
- OLAP Product: TM1
- Version: 10.1
- Excel Version: Office 10
Re: Help with dynamic subset
I added an attribute called TotalFlag, applied a 'Yes" to Total Products and added that to my MDX. While it worked, your solution is simpler and would allow me to add other subtotals if they were ever added to the product dimension, so I used it. Thanks!tomok wrote:Just add this to the front of your MDX:
{[dimProducts].[Total Products]} +
Mike