15 Replies Latest reply: Jul 25, 2018 1:27 AM by sunil kumar

# Range Bucket

I need to Count Distinct CUST_CD&DIST_CD where DISC_TYPE = F and MTD_VOL<40&>0. Can anyone suggest how to set range in set ananlysis.

• ###### Re: Range Bucket

Hi,

Count({\$<MTD_VOL={">0<40"},DISC_TYPE={'F'}>}CUST_CD)+ Count({\$<MTD_VOL={">0<40"},DISC_TYPE={'F'}>}DIST_CD)

• ###### Re: Range Bucket

or this

Count({\$<MTD_VOL = {">0<40"}, DISC_TYPE = {'F'}>}DISTINCT CUST_CD&DIST_CD)

• ###### Re: Range Bucket

MTD_Vol is not a field, i am calculating it using expression, so that expression how i can use in set analysis for particular range.

• ###### Re: Range Bucket

Would you be able to share a sample to show what you have and what you are looking to get?

• ###### Re: Range Bucket

I am calculating volume from table Invoice_details and Production_hierarchy using fields TTL and UOM

i.e volume = (TTL / UOM)

and logic in which i have to use MTD_Volume is

(0<X<10):

Count of Distinct CUST_CD&DIST_CD in CUSTOMER where VISI/NVISI = VISI in CUSTOMER and MTD_VOL<10&>0.

• ###### Re: Range Bucket

MTD_Vol is not a field, i am calculating it using expression, so that expression how i can use in set analysis for particular range.

• ###### Re: Range Bucket

And is it problem for you to calculate it in a script? Than you could use our suggestions above.

Otherwise you will have to use an IF statement. Something like

If(MTD_VOL expression >0 and MTD_VOL expression<40,Count({\$<DISC_TYPE={'F'}>}CUST_CD)+ Count({\$<DISC_TYPE={'F'}>}DIST_CD) ))

• ###### Re: Range Bucket

Try following expression :

Count({<DISC_TYPE = {'F'},MTD_VOL={">0<40"}>}Distinct CUST_CD)

+

Count({<DISC_TYPE = {'F'},MTD_VOL={">0<40"}>}Distinct DIST_CD )

• ###### Re: Range Bucket

Hi Deepak,

Try the following statement.

Count( {<DISC_TYPE = {'F'},  MTD_VOL={">0 <40"}>}  distinct CUST_CD)

+

Count( {<DISC_TYPE = {'F'},  MTD_VOL={">0 <40"}>}  distinct DIST_CD)

• ###### Re: Range Bucket

Hi Simran,

MTD_VOL is not a field, its expression, i am calculating MTD_VOL = (TTL / UOM),

How can i use this logic in set analysis as MTD_VOL={">0 <40"}.

• ###### Re: Range Bucket

Hi Deepak,

Can't you make the field MTD_VOL i.e. (TTL / UOM) in the backend and then just use MTD_VOL in the set expression.

Thanks,

Simran

• ###### Re: Range Bucket

No its not possible to make field in the backend, so I want to calculate it frontend only.

• ###### Re: Range Bucket

Hi Deepak,

If((TTL / UOM) >0 and (TTL / UOM) <40,Count({\$<DISC_TYPE={'F'}>}CUST_CD)+ Count({\$<DISC_TYPE={'F'}>}DIST_CD) ))

can you try using above expression and let us know

• ###### Re: Range Bucket

can we create composite key on front end for CUST_CD and DIST_CD like (CUST_CD&DIST_CD), so we don't need to define count expression twice.

Is that possible by this way?

• ###### Re: Range Bucket

can you try

If((TTL / UOM) >0 and (TTL / UOM) <40,Count({\$<DISC_TYPE={'F'}>}CUST_CD+DIST_CD) )

are

or

create a variable =

vComp = CUST_CD+DIST_CD

If((TTL / UOM) >0 and (TTL / UOM) <40,Count({\$<DISC_TYPE={'F'}>} \$(vComp ) ) )