SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Calculation using a Calculated Measure


Calculation using a Calculated Measure

Author
Message
Michael Earl-395764
Michael Earl-395764
SSCertifiable
SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)

Group: General Forum Members
Points: 6741 Visits: 23078
I have a calculated measure that is based on two other measures. It is pretty close to this:

CASE
WHEN [Measures].[SkipUnits] > [Measures].[Units] THEN null
ELSE [Measures].[Units] - [Measures].[SkipUnits]
END


Obviously, I need to reduce my units by my skipped units but the units calculation cannot be less than zero.
This is all dandy until this measure is used by a calculation showing the variance between this year and last year (or any other variance). In these cases, I want the calculated measure to calculate first and then the variance calculated because it is ok to have a negative variance.

Anyone have a way of doing this that does not involve specifying the calculation for this measure manually for each of the variance calculations? Unfortunately, I have a lot of them.
stevefromOZ
stevefromOZ
SSCarpal Tunnel
SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)

Group: Moderators
Points: 4668 Visits: 3757
You should be able to specify the solve order. I think it was the higher the number the later in the calc pass it would resolve (ie set the calc based on calc to be a number > first calc). It's a little dated now but here's a blog entry on creating calc members, you could also check out the info on msdn re: calc scripts.

Steve.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search