Showing posts with label calculation. Show all posts
Showing posts with label calculation. Show all posts

Friday, March 9, 2012

Defining Analysis Services Named Calculation

Hi,

I am creating a new Named Caluclation for time dimension in dsv and added in the time dimension cube from the data source view in the time dimension structre.

While processing it is giving the error message that

"Memory error: The operation cannot be completed because the memory quota estimate exceeds the available system memory"

Can you please help me.

Thanks

Dinesh

What does the named calculation look like? And does it process if you take it out?

Cheers

Matt

|||

Show us the named calculation statment...

Works ok without the Named Calculation?!

Regards

|||

Hi

I have used the named calculation "ReportDate + ' ' + Session" in time dimension.

can you let me know how to add this namedcalculation to the cube after creating the named calcualtion in dsv.

Thanks

Dinesh

|||

Hi,

ReportDate and Session are both strings? If not you probably get problems, you will need to cast them as a string/varchar in order for your named calculation to work.

Adding to a dimension, just edit your dimension and drag it onto the attributes list. If it is a new measure, edit your cube and right click, add new measure, select the new named calculation.

Hope that helps

Matt

|||

You already created the NC in the DSV? Correct?

The cube processing generate errors only after your created the NC, correct?

Regards

|||

Hi,

ReportDate and Session are both strings. I added that into atribute list and processed.

It is giving the error message like

"Memory error: The operation cannot be completed because the memory quota estimate (1976MB) exceeds the available system memory (659MB). "

So, what to do for this type of error

Thanks

Dinesh

|||

Hi,

Looks like this is a known bug with SSAS, I haven't seen it before, but it looks like there is a hotfix for it.

http://support.microsoft.com/kb/914595

Hope that helps

Matt

|||

Hi,

Yes after creating the NC only this problem came. before i tested the cube there is no problem.

can you please let me know what is the problem.

Thanks

Dinesh

|||

Check the Matt link and fix the bug, if you will still need some help, tell us!

regards!

Sunday, February 19, 2012

Default Value Calculation

Hi,
Is there a way to calculate the Default Value of a column with other data
columns? Using "date_of_birth" column and "screen_date" columns, I would
like to calculate the "age" automatically with the Default Value definition.
Please let me know if it's possible.
YC> Is there a way to calculate the Default Value of a column with other data
> columns? Using "date_of_birth" column and "screen_date" columns, I would
> like to calculate the "age" automatically with the Default Value
> definition.
Why would you need to store this data? If you have 2 in one column and 2 in
another column, do you really need to store 4 in a "sum" column, when you
can do this in a view or procedure?
Anyway, I think you want to use a computed column, not a default value.
E.g.:
CREATE TABLE dbo.MyTable
(
db SMALLDATETIME,
sd SMALLDATETIME,
age_in_days AS CONVERT(INT, DATEDIFF(DAY, db, sd))
)
GO
SET NOCOUNT ON
INSERT dbo.MyTable(db, sd) SELECT '20050101', GETDATE())
INSERT dbo.MyTable(db, sd) SELECT '20050501', '20050505')
SELECT * FROM dbo.MyTable
GO
DROP TABLE dbo.MyTable
GO|||Hi
It is not clear why you would want to store the age in this way. Current Age
would be SELECT DATEDIFF(yy,dob, getdate()) which could be added to an
INSTEAD OF trigger. If you want to have a more up-to-date age you can use
the function in a view e.g.
CREATE VIEW vw_Users AS
SELECT Name, dob, DATEDIFF(yy,dob, getdate()) AS Age
FROM tbl_users
SELECT Name, dob, age
FROM vw_Users
John
"Asp Psa" wrote:

> Hi,
> Is there a way to calculate the Default Value of a column with other data
> columns? Using "date_of_birth" column and "screen_date" columns, I would
> like to calculate the "age" automatically with the Default Value definitio
n.
> Please let me know if it's possible.
> YC
>
>|||John's formula does not break on the birthday. It will tell you how old
someone will be at the end of a year.
Aaron's formula can be tweaked to provide a person's age as of today. It
can be put into a computed column as Aaron has suggested or in a user-define
d
function or stored procedure.
CONVERT(INT, DATEDIFF(DAY, dob, getdate()) / 365.25) as age
Personlly, I would not store the age in a table because it's subject to
change each day. Or, if you need what year it is for the person (John's
formula) then you have to refresh the table data once per year.
Hope that helps,
Joe
"John Bell" wrote:
> Hi
> It is not clear why you would want to store the age in this way. Current A
ge
> would be SELECT DATEDIFF(yy,dob, getdate()) which could be added to an
> INSTEAD OF trigger. If you want to have a more up-to-date age you can use
> the function in a view e.g.
> CREATE VIEW vw_Users AS
> SELECT Name, dob, DATEDIFF(yy,dob, getdate()) AS Age
> FROM tbl_users
> SELECT Name, dob, age
> FROM vw_Users
> John
> "Asp Psa" wrote:
>|||> Why would you need to store this data?
Aaron,
sometimes we do that to speed queries up.
For instance, if there are columns order_date and shipment_date,
turnaround (days between ordering and shipment) and shipment_month can
be calculated no problem. But if there are many frequently running
queries involving these expressions, such as
select ...
where turnaround>10
select sum(amount), shipment_month, turnaround
from orders
group by shipment_month, turnaround
it really helps to create an index on (turnaround, shipment_month,
amount)
Makes sense?|||> Makes sense?
Yes, of course. I was asking if the OP really needed to do it, I don't
recall saying, "don't do that, it's stupid and doesn't make sense."|||I agree that this is not the way to go. It would be best to calculate
it in a view. BTW, sometimes age is static. For example a patient's
age is that at the time of admission. If you really need a separate
field for this, you could create a simple trigger.|||Joe
As people are born on different days, you will need to refresh it every day
(just in case!)!
John
"Joe from WI" wrote:
> John's formula does not break on the birthday. It will tell you how old
> someone will be at the end of a year.
> Aaron's formula can be tweaked to provide a person's age as of today. It
> can be put into a computed column as Aaron has suggested or in a user-defi
ned
> function or stored procedure.
> CONVERT(INT, DATEDIFF(DAY, dob, getdate()) / 365.25) as age
> Personlly, I would not store the age in a table because it's subject to
> change each day. Or, if you need what year it is for the person (John's
> formula) then you have to refresh the table data once per year.
> Hope that helps,
> Joe
> "John Bell" wrote:
>|||Age changes from day to day, so put the calculation in a VIEW. Do not
store computed data.|||I might have misread these posts.
A computed column is persisted only when required, for instance at the time
of use on the select clause.
Its not calculated and stored, unless its value is deterministic in which
case you would index and only then is the value persisted.
Its a lot more efficient and easier to do these age things based on timenow
using a computed column rather than a view.
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:C1B2D6CE-5BE3-46A3-AE8A-72E95161011D@.microsoft.com...
> Joe
> As people are born on different days, you will need to refresh it every
> day
> (just in case!)!
> John
> "Joe from WI" wrote:
>