Use of ATTRS function in a rule

Post Reply
tkingcka
Posts: 28
Joined: Fri Nov 13, 2009 12:02 pm
OLAP Product: IBM Cognos TM1
Version: 10.2.2
Excel Version: 2013

Use of ATTRS function in a rule

Post 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
tkingcka
Posts: 28
Joined: Fri Nov 13, 2009 12:02 pm
OLAP Product: IBM Cognos TM1
Version: 10.2.2
Excel Version: 2013

Re: Use of ATTRS function in a rule

Post by tkingcka »

The cube dimensions are as follows for the EAC Cube:

Version; DataSource; Org; Account; Time; Measures
Wim Gielis
MVP
Posts: 3230
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Use of ATTRS function in a rule

Post 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?
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
tkingcka
Posts: 28
Joined: Fri Nov 13, 2009 12:02 pm
OLAP Product: IBM Cognos TM1
Version: 10.2.2
Excel Version: 2013

Re: Use of ATTRS function in a rule

Post 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.
Post Reply