6 Replies Latest reply: Feb 16, 2017 2:34 PM by Richard Judkins

# Wildmatch with two criteria

Hey all

So I have the following: (if (WildMatch(PROD_GROUP, '*Mud*','*Salt*'),'Mud and Salt',null)), with the measure being count(customers).

The issue I have is that it is returning the count of the total number of customers who have Mud, and the total number who have Salt.

What I want is the number of customers who have both products.

Thanks

• ###### Re: Wildmatch with two criteria

Try like:

Dimension: PROD_GROUP

Exp: count({<PROD_GROUP={'*Mud*'}>*<PROD_GROUP={'*Salt*'}>}customers)

• ###### Re: Wildmatch with two criteria

Hi

Change it to

(if (WildMatch(PROD_GROUP, '*Mud*')>0 and WildMatch(PROD_GROUP, '*Salt*')>0),'Mud and Salt',null)),

Regards

Pratyush

• ###### Re: Wildmatch with two criteria

hi try this its working

aa:

Record, Date, Year ,Product

abc, 7/9/2015, 2015,salt

bc, 6/8/2015, 2015,sugar

aabc, 4/1/2015, 2015,salt

abgc, 16/2/2016, 2016,rice

abcv, 6/1/2016, 2016,sugar

abcn, , 2017,salt

abcj, , 2017,sugar

]

;

if(WildMatch(Product,'*sa*','sugar'),'Mud and Salt','null') as result

Resident aa;

• ###### Re: Wildmatch with two criteria

You mean you want an AND rather than an OR between the criteria? I assume that you have multiple rows for each customer, so that one row could contain Mud and the other Salt? If the previous suggestions don't work for you, try the below.

I think that this is syntactically correct (intersection of customers with *mud* AND *salt*):

Count({<customers = P({<PROD_GROUP = {'*Mud*'}>})> * <customers = P({<PROD_GROUP = {'*Salt*'}>})>} customers)

You may need a DISTINCT:

Count({<customers = P({<PROD_GROUP = {'*Mud*'}>})> * <customers = P({<PROD_GROUP = {'*Salt*'}>})>} DISTINCT customers)

• ###### Re: Wildmatch with two criteria

In a calculated dimension:

Aggr(Only({<customers = P({<PROD_GROUP = {'*Mud*'}>})> * <customers = P({<PROD_GROUP = {'*Salt*'}>})>} customers), customers)

But I would avoid that construct unless you have a very small data set. Rather add a derived 'Mud and Salt' field during the load.

• ###### Re: Wildmatch with two criteria

Thank you for the help (and to the other repliers as well!)