Page 1 of 1
Business Rules Help
Posted: Fri Aug 19, 2016 4:51 pm
by ALAHARI
Hi
I AM TRYING TO WRITE A RULE MIMICKING AN EXCEL BY COMPARING 2 VALUES IN A CUBE . NOT SURE IF I AM DOING CORRECTLY.
IN EXCEL THE LOGIC IS IF HIGHESTREMOVAL IS 0 THEN NEW ALLOCATION
['FINALALLOCATION' ] = N:IF(['HIGHESTREMOVAL' ] @= 0, ['NEWALLOCATION' ] ,STET);
APPRECIATE YOUR HELP.
Re: Business Rules Help
Posted: Fri Aug 19, 2016 4:54 pm
by tomok
ALAHARI wrote:Hi
I AM TRYING TO WRITE A RULE MIMICKING AN EXCEL BY COMPARING 2 VALUES IN A CUBE . NOT SURE IF I AM DOING CORRECTLY.
IN EXCEL THE LOGIC IS IF HIGHESTREMOVAL IS 0 THEN NEW ALLOCATION
['FINALALLOCATION' ] = N:IF(['HIGHESTREMOVAL' ] @= 0, ['NEWALLOCATION' ] ,STET);
APPRECIATE YOUR HELP.
"@=" is for string comparisons. For numeric just use "=".
Re: Business Rules Help
Posted: Fri Aug 19, 2016 5:10 pm
by ALAHARI
Thanks!!!!Tom
I am trying to replicate the below string case statement . can you please correct me
excel-=IF(AND(LANDINGS="NO",'CURRENTONHAND'>0),"Excess Stock",
IF(AND(LANDINGS="NO",CURRENTONHAND>0),"Excess Allocation",
['REVIEWCODE' ] = N:IF (!LANDINGS @= 'NO' & ['CURRENTONHAND' ] > 0, 'EXCESS STOCK',CONTINUE);
['REVIEWCODE' ] = N:IF (!LANDINGS @= 'NO' & ['CURRENTALLOCATION' ] > 0, 'EXCESS STOCK');
Re: Business Rules Help
Posted: Fri Aug 19, 2016 6:06 pm
by Wim Gielis
Perhaps:
Code: Select all
['REVIEWCODE' ] = S:IF (!LANDINGS @= 'NO' & ['CURRENTONHAND' ] > 0, 'EXCESS STOCK',CONTINUE);
['REVIEWCODE' ] = S: IF (!LANDINGS @= 'NO' & ['CURRENTALLOCATION' ] > 0, 'EXCESS STOCK', '');
Re: Business Rules Help
Posted: Fri Aug 19, 2016 6:18 pm
by declanr
Just to add to Wim's reply you need to use =S: notation to populate a string (text) measure; for this to work you need to make sure that ReviewCode exists in the dimension that is last in order in the cube and is given a string type.
You can also make the code slightly shorter; the !landings notation can go on the left hand side of your rule and you can remove the need for 2 separate statememts:
Code: Select all
['NO','ReviewCode']=S:
If ( ['CurrentOnHand'] > 0 % ['CurrentAllocation'] > 0, 'Excess Stock','');
Re: Business Rules Help
Posted: Fri Aug 19, 2016 6:57 pm
by ALAHARI
Thanks you guys!!!