Page 1 of 1

Use cell value in a DB() statement

Posted: Tue Aug 03, 2010 8:39 am
by dan.stroebel
Hi,

I want to parametrise a query.
I have a cube stating the years which looks like this:

Code: Select all

(Admin_Timescale cube)

              | dummy
--------------+-------
Current Year  | 2010
Next Year     | 2011
So, I want to use the cell Current Year here to determine which year should be used in another cube for calculation.
However, this rule is results in all calculated cells being zero:

Code: Select all

['Next_Year_Plan_Value'] = DB('Strategic_Plan', 'PLAN', DB('Admin_Timescale', 'dummy', 'Current Year'), !Products, !MEASURES);
How can I use the other cube's value properly in a DB() statement?

Thanks,
Dan

Re: Use cell value in a DB() statement

Posted: Tue Aug 03, 2010 11:37 am
by Wim Gielis
Dan

This seems okay, syntax-wise.

Is the order of the dimensions correctly in your rule? (for both cubes)

You can also put an alias on the time dimensions, saying the alias Current that you put on the correct year. Then you know that the element Current is always valid.

Re: Use cell value in a DB() statement

Posted: Tue Aug 03, 2010 11:41 am
by Alan Kirk
dan.stroebel wrote:Hi,

I want to parametrise a query.
I have a cube stating the years which looks like this:

Code: Select all

(Admin_Timescale cube)

              | dummy
--------------+-------
Current Year  | 2010
Next Year     | 2011
So, I want to use the cell Current Year here to determine which year should be used in another cube for calculation.
However, this rule is results in all calculated cells being zero:

Code: Select all

['Next_Year_Plan_Value'] = DB('Strategic_Plan', 'PLAN', DB('Admin_Timescale', 'dummy', 'Current Year'), !Products, !MEASURES);
How can I use the other cube's value properly in a DB() statement?

Thanks,
Dan
Is the Current Year value an N type cell or an S type cell? Normally DB would be used to return a numeric value. I may be wrong about this since it's been a long day and I'm in too much need of sleep to test it right now, but I think that if you're using it as you are here, to return an element name of another DB() formula, you'd need it to be returning a string.

Re: Use cell value in a DB() statement

Posted: Tue Aug 03, 2010 12:16 pm
by dan.stroebel
Alan, as always, you're right.
Changing from numeric to string elements fixed the issue.

Thanks,
Dan