Gets customer ids with measure greater than X

Tobias Strobel 41 Reputation points
2021-11-12T10:39:53.687+00:00

Hi,

im trying to get something to work and maybe (hopefully) it needs just some tweaking.
I need to add something to my multidimension cube.

I have the following measure that is working as intended, it COUNTS the customers having a certain measure >= X in this case 1000:

CREATE MEMBER CURRENTCUBE.[Measures].[Count customers with Value > 1000] AS 
 AS count(
            filter(
                  [Customer].[Customer ID].[Customer ID].members,
                  Aggregate([Datatype].[Datatype].&[Act],[Measures].[Value]) >= 1000
                  )
       ), 
VISIBLE = 1;

Now INSTEAD of the number of customers i need the customer ids themselves. By adding an element to a dimension.

This is the idea behind what im trying to do.

It works, it a simply links ONE example customer to this attribut.

CREATE MEMBER CURRENTCUBE.[Customer].[Customer ID].[Custom Value > 1000] AS 
[Customer].[Customer ID].&[00000000], 
VISIBLE = 1;

What i need is to use the logic of the measure that is counting the customers with a value higher than X, but instead just returns the customers themselves without the count. I tried the following versions but could not get it to work.

Its bascically using the "one Example" version with the reduced logic of "count" measure.
But it does not work.

CREATE MEMBER CURRENTCUBE.[Customer].[Customer ID].[Customers with Value > 1000] AS 
filter(
[Customer].[Customer ID].[Customer ID].members,
Aggregate([Datatype].[Datatype].&[Act],[Measures].[Value]) >= 1000
   ), 
VISIBLE = 1;

CREATE MEMBER CURRENTCUBE.[Customer].[Customer ID].[Customers with Value > 1000] AS 
filter(
[Customer].[Customer ID].[Customer ID],
Aggregate([Datatype].[Datatype].&[Act],[Measures].[Value]) >= 1000
   ), 
VISIBLE = 1;

Maybe anyone knows what my mistake is in the 2 attempts i made.

I hope/assume its just some small adjustment to actually make it work since the measure already does what its intended to do.

SQL Server Analysis Services
SQL Server Analysis Services
A Microsoft online analytical data engine used in decision support and business analytics, providing the analytical data for business reports and client applications such as Power BI, Excel, Reporting Services reports, and other data visualization tools.
1,311 questions
{count} votes

Accepted answer
  1. Darren Gosbell 2,376 Reputation points
    2021-11-15T00:33:40.057+00:00

    A member can only ever return a single row. To return multiple rows what you need is a named set.

    eg

    CREATE SET CURRENTCUBE.[Customer].[Customers with Value > 1000] AS ...

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. CarrinWu-MSFT 6,891 Reputation points
    2021-11-15T07:23:50.16+00:00

    Hi @Tobias Strobel ,

    Welcome to Microsoft Q&A!

    Please try below script:

    CREATE MEMBER CURRENTCUBE.[Measures].[Count customers with Value > 1000] AS  
    IIF(  
    ( [Customer].[Customer ID].currentmember,  
    Aggregate([Datatype].[Datatype].&[Act],[Measures].[Value])) >= 1000  
    , 1,null  
    ),  
    VISIBLE = 1;  
    

    Best regards,
    Carrin


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.