Page 1 of 1

Use of ATTRS function in a rule

Posted: Wed Oct 16, 2013 9:56 am
by tkingcka
I am trying to use the ATTRS function in a rule with an IF statement to perform a calculation when the Service Accounting Field is not 'Y', however I am getting an error when trying to save the rule. The rule I have created is in an EAC cube and should not calculate Total Sales before Adjustments on Service Accounting Orgs. For all other Orgs, it should calculate. There are only nine Service Accounting Orgs I need to have the calculation ignore and enter a value of zero (0). Thus I thought it would be easiest to create a rule using the ATTRS function:

Total Sales Before Adjustment = N:If(ATTRS('Org', !Org, 'Service Accounting')@='Y',0,['Subtotal Costs']/1-['Booking Rate','Current Month']));

The rule saved, but does not calculate any values. If I remove the If(ATTRS('Org', !Org, 'Service Accounting')@= 'Y',0, section of the code, it works fine. I think my issue is around the !Org section of the code, as I wanted it to look at all elements in the Org dimension. Any help would be much appreciated.

I am working on Cognos 10.1.1 64 Bit with Microsoft Excel 2007

Re: Use of ATTRS function in a rule

Posted: Wed Oct 16, 2013 10:04 am
by tkingcka
The cube dimensions are as follows for the EAC Cube:

Version; DataSource; Org; Account; Time; Measures

Re: Use of ATTRS function in a rule

Posted: Wed Oct 16, 2013 9:59 pm
by Wim Gielis
If 'Total Sales Before Adjustment' does not belong to the Org dimension, I don't see anything wrong immediately. Obviously, more detail will be needed if you want us to highlight your error.
If 'Total Sales Before Adjustment' is part of the Org dimension, it's obvious that your rule will only apply to 1 element.

I think that the first case applies, but I would say that your rule should work fine.
The attribute values are correct? (a 'Y' or not a 'Y')
Did you use Trace calculation in a cube view?

Re: Use of ATTRS function in a rule

Posted: Thu Oct 17, 2013 2:54 pm
by tkingcka
Thank you for your response. I went back into the rules editor and tried saving the rule again and it save. It was pretty wierd, as I thought the rule was correct to begin with, per your comments. Oh well. It is good to go.