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

Saturday, February 25, 2012

Conditional Font Weight

I need to conditionally set the font weight of my data when a calculation is equal to or less than 70. I am using the following expression in the font weight property:
=iif(( Fields!Answer1.Value/ Fields!SumStudents.Value)*100 <=70, "Extra Bold", "Normal")
I get no errors when I run my report, however it does not apply the correct weith to my display. I am positive the calculation is correct since I use it in other conditions and they work fine.
Any help would be apreciated.Extra Bold maps to 800. You can check this by placing a textbox on the
design surface and setting the Font Weight to Extra Bold. Next open the code
view for the report and check the value serialized for the textbox font
weight.
=iif(( Fields!Answer1.Value/ Fields!SumStudents.Value)*100
<=70, "800", "Normal")
--
Bruce Johnson [MSFT]
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"CarrieWells" <CarrieWells@.discussions.microsoft.com> wrote in message
news:4AFCE118-56E0-4B52-A7B8-B8D551290D6E@.microsoft.com...
> I need to conditionally set the font weight of my data when a calculation
is equal to or less than 70. I am using the following expression in the font
weight property:
> =iif(( Fields!Answer1.Value/ Fields!SumStudents.Value)*100 <=70, "Extra
Bold", "Normal")
> =iif(Fields!Quantity.Value > 10, "Normal", "Bold")
> I get no errors when I run my report, however it does not apply the
correct weith to my display. I am positive the calculation is correct since
I use it in other conditions and they work fine.
> Any help would be apreciated.
>

Friday, February 24, 2012

Conditional calculation in SQL for CR

I am trying to calculate a value using an IF in a SQL statement. Below is what I am trying. I am not sure what is wrong with the IF. The error says missing operator.

SELECT
cr_401k_data_sheet1.`Department`,
SUM (cr_401k_data_sheet1.`Gross`) As Gross,
SUM (cr_401k_data_sheet1.`Contribution`) As Contribution,
SUM( cr_401k_data_sheet1.Gross*.05) As Limit,
(if SUM(Contribution) <> Limit then Contribution) As Match
FROM
`cr_401k_data_sheet1` cr_401k_data_sheet1
GROUP BY
cr_401k_data_sheet1.`Department`,

Thanks in advance,
vmonyou cannot use IF in crystal SQL, infect you cannot use IF in any SQL, untill you are using a stored procedure

how ever you can do this calulation in Crystal, from your query it seems like you want to calculate MACTH where Sum(Contribution) <> SUM(LIMIT), thats you can do in crystal by writing a formula.

Conditional calculated member

Hi there, I have a newbe MDX question.
Im trying to make a calculated member that contains a different calculation depending on a value of an attribute.
something like: "CASE WHEN Attribute X = "string A" THEN calculation X ELSE calculation Z" I tried the IFF and the CASE statement, but with negative results
Any Suggestions?

I am using MS AS 2005 RTM.A more efficient way to achieve this in AS 2005 (assuming that AttributeHierarchyEnabled is set to True for Attribute X) is to scope the calculation in the cube MDX Script on Attribute X. This Newsgroup thread explains how, in a similar situation:

http://groups.google.com/group/microsoft.public.sqlserver.olap/msg/3f05cf53d0cf9f06
>>

Newsgroups: microsoft.public.sqlserver.olapFrom:"Chris Webb"

Subject: Re: MDX Scripts and Aggregations

...

Am I right in thinking that Guest Factor is also an attribute on your
Customer dimension? If it isn't, it probably should be. If it is, then
instead of scoping on all customers and testing whether they have Guest
Factor=1, you should scope on the Guest Factor attribute directly. The script
would end up looking something like this:

CALCULATE;

SCOPE ([Measures].Angel);
SCOPE ([PRODUCT].[PRODUCT].&[2]);
SCOPE([CUSTOMER].[CUSTOMER].members, [CUSTOMER].[Guest
Factor].&[1]);
THIS =
([PRODUCT].[PRODUCT].&[1])
* ( [CUSTOMER].[CUSTOMER].&[ADULTS])
/ ( [CUSTOMER].[CUSTOMER].&[ADULTS], [PRODUCT].[PRODUCT].&[1]
)

END SCOPE;
END SCOPE;
END SCOPE;

As I understand it, by getting rid of the CASE statement and scoping
directly on the area of the cube you want the calculation will be much faster
- there'll be no checking whether Guest Factor=1 happening at runtime.

...
>>