Page 1 of 1

How to write sum function

Posted: Tue Mar 19, 2013 3:18 am
by blusky_1010
i have a cube with Dimension follow:
https://plus.google.com/u/0/photos/1114 ... oOkp5vOsgE
i want to calculation ['DONGTHU','02.2013'] = sum ['DONGTHU' (02.2013----> END Of Row)]
please help me!
Thanks so much!

Re: How to write sum function

Posted: Tue Mar 19, 2013 3:50 am
by Alan Kirk
blusky_1010 wrote:i have a cube with Dimension follow:
i want to calculation ['DONGTHU','02.2013'] = sum ['DONGTHU' (02.2013----> END Of Row)]
please help me!
It appears that what you want is to calculate the sum of the "Year To Go"; that is, the sum of all months from the current one to the end of the year. You do that by just creating a consolidation hierarchy. You should know how to do that since you already have one in the screenshot where you've added up all of the month elements to get the year elements.

The consolidation element YTG 12.2013 is defined as the N level element 12.2013
The consolidation element YTG 11.2013 is defined as the consolidation element YTG 12.2013 + the N level element 11.2013
The consolidation element YTG 10.2013 is defined as the consolidation element YTG 11.2013 + the N level element 10.2013
and so on until you reach
The consolidation element YTG 02.2013 which is defined as YTG 03.2013 + 02.2013

In that way you get the value that you want by selecting the combination of the DongThu element, and the YTG 02.2013 element.

Re: How to write sum function

Posted: Tue Mar 19, 2013 4:30 am
by blusky_1010
Alan Kirk wrote:
blusky_1010 wrote:i have a cube with Dimension follow:
i want to calculation ['DONGTHU','02.2013'] = sum ['DONGTHU' (02.2013----> END Of Row)]
please help me!
It appears that what you want is to calculate the sum of the "Year To Go"; that is, the sum of all months from the current one to the end of the year. You do that by just creating a consolidation hierarchy. You should know how to do that since you already have one in the screenshot where you've added up all of the month elements to get the year elements.

The consolidation element YTG 12.2013 is defined as the N level element 12.2013
The consolidation element YTG 11.2013 is defined as the consolidation element YTG 12.2013 + the N level element 11.2013
The consolidation element YTG 10.2013 is defined as the consolidation element YTG 11.2013 + the N level element 10.2013
and so on until you reach
The consolidation element YTG 02.2013 which is defined as YTG 03.2013 + 02.2013

In that way you get the value that you want by selecting the combination of the DongThu element, and the YTG 02.2013 element.
thanks so much, i'll try to do it :)

Re: How to write sum function

Posted: Wed Mar 20, 2013 8:08 am
by blusky_1010
Alan Kirk wrote:
blusky_1010 wrote:i have a cube with Dimension follow:
i want to calculation ['DONGTHU','02.2013'] = sum ['DONGTHU' (02.2013----> END Of Row)]
please help me!
It appears that what you want is to calculate the sum of the "Year To Go"; that is, the sum of all months from the current one to the end of the year. You do that by just creating a consolidation hierarchy. You should know how to do that since you already have one in the screenshot where you've added up all of the month elements to get the year elements.

The consolidation element YTG 12.2013 is defined as the N level element 12.2013
The consolidation element YTG 11.2013 is defined as the consolidation element YTG 12.2013 + the N level element 11.2013
The consolidation element YTG 10.2013 is defined as the consolidation element YTG 11.2013 + the N level element 10.2013
and so on until you reach
The consolidation element YTG 02.2013 which is defined as YTG 03.2013 + 02.2013

In that way you get the value that you want by selecting the combination of the DongThu element, and the YTG 02.2013 element.
Hi Mr Alan Kirk!
I do it work, but with my DimensionYear i must wire rules for one box, it that means i have to write 12 month * 5 year fomular, i would write alittle than more, can you give me a solusion for rules or re-designs my DimensionYear

Thanks alot!!

Re: How to write sum function

Posted: Wed Mar 20, 2013 8:37 am
by lotsaram
blusky_1010 wrote: Hi Mr Alan Kirk!
I do it work, but with my DimensionYear i must wire rules for one box, it that means i have to write 12 month * 5 year fomular, i would write alittle than more, can you give me a solusion for rules or re-designs my DimensionYear

Thanks alot!!
It should be possible to write a generic rule as opposed to hardcoding the "lookups" for each specific case. This might be possible simply via naming convention and combination of SubSt and concatenation or you might need a lookup attribute or lookup cube but it will definitely be possible. However unless you post some ACTUAL CODE and the exact cube dimensionality then it isn't going to be possible to provide assistance.

Re: How to write sum function

Posted: Thu Mar 21, 2013 3:12 am
by blusky_1010
lotsaram wrote:
blusky_1010 wrote: Hi Mr Alan Kirk!
I do it work, but with my DimensionYear i must wire rules for one box, it that means i have to write 12 month * 5 year fomular, i would write alittle than more, can you give me a solusion for rules or re-designs my DimensionYear

Thanks alot!!
It should be possible to write a generic rule as opposed to hardcoding the "lookups" for each specific case. This might be possible simply via naming convention and combination of SubSt and concatenation or you might need a lookup attribute or lookup cube but it will definitely be possible. However unless you post some ACTUAL CODE and the exact cube dimensionality then it isn't going to be possible to provide assistance.
Dear Mr Alan Kirk !
My cube have three Dimension: DimensionYear, DuAn, NhuCauVon as the picture i posted behind, and i must caculation with Sum funtion in Excel, i had built the Cosolidate Year Go To as you say, but i get a problem with sum funtion opposite dimension
Ex: O26=SUM($C$26:N26)
and O22= sum(P22:$BV$22)
What can i do?
please help me,
thanks so much!