Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 Count expression on condition

Author  Topic 

ismailc
Constraint Violating Yak Guru

290 Posts

Posted - 2008-04-25 : 05:23:43
Hi, i need help please!

I want to show a count of the following:
Field values = "CFG1" , "CFG2"

So i want to count the number of "CFG2" values there are.

I tried something like this but does not work.

=count(Fields!Task.Value="CFG2")

Please Assist!

Regards

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-25 : 07:15:36
=Sum(iif(Fields!Task.Value="CFG2",1,0))
Go to Top of Page

ismailc
Constraint Violating Yak Guru

290 Posts

Posted - 2008-04-25 : 08:10:09
Thank You very Much - it works great!!!
Really Appreciate it!


Do you know how i can manipulate to show an image or background image on condition if a value = "yes"

Regards!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-25 : 11:31:15
Yup write an expression in the image or background image property

=IIF(Fields!YourField.Value ="Yes",firstimagepath,secondimagepath)
Go to Top of Page

ismailc
Constraint Violating Yak Guru

290 Posts

Posted - 2008-04-29 : 05:48:32
Great stuff!!!
=IIF(Fields!CFGCst.Value="Y","incorrect.jpg","correct.jpg")

Apologies 2 more:
I have the Backgroundimage sorted, but I can't align the image as it is set to the left & i would like to center the image with the text?

If text is bigger than column i want it to cut the text off & not go to a new line, i have played with the CanGrow & Canshrink properties but I can't get it going!


Please Assist, Regards
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-29 : 06:28:39
To align image to center, you can try changing the padding property of the cell. Increase left padding and see.
Not quite sure how we can compare the text with column size. but one workaround would be to manually check column width and if length is more than value truncate it may be put an expression like:-

IIF(Len(Fields!textfield.value)> yourvalue,Left(Fields!textfield.value,yourvalue),Fields!textfield.value)
Go to Top of Page

ismailc
Constraint Violating Yak Guru

290 Posts

Posted - 2008-04-29 : 07:24:29
The cutting off of text works
=IIF(Len(Fields!Originator.Value)> 16,Left(Fields!Originator.Value,16),Fields!Originator.Value)

but the padding of the image is actually a problem.

I want the image to be in the background of the text in the center, when i set the padding it moves the text.

i'm sorry to do this: Date format
current: 18/04/2008
I want it to display: 18 Apr 08

Please Assist, Regards
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-29 : 07:54:53
Use FormatDateTime function
Go to Top of Page

ismailc
Constraint Violating Yak Guru

290 Posts

Posted - 2008-04-29 : 07:56:47
Hi, i managed to get pass the image align.
I edited the image and made it the size of the column adding the image in the ceter and adding spaces in between.

Any luck on the date formating
from: 18/04/2008
to: 12 Apr 08

Please Assist, Regards
Go to Top of Page

ismailc
Constraint Violating Yak Guru

290 Posts

Posted - 2008-04-29 : 08:05:37
I tried the following but display error:
=FormatDateTime(Fields!StartDte.Value,"ddmmmyy")
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-29 : 08:13:44
Try:-
=FormatDateTime(Fields!StartDte.Value,1)
Go to Top of Page

ismailc
Constraint Violating Yak Guru

290 Posts

Posted - 2008-04-29 : 08:58:25
Thank You!

The expression did not work, i really struggle once it comes to expressions.

I managed to do it in my sql:
convert(nvarchar, TaskReceived, 6) as Tasktest

Thank You very much!!!
Go to Top of Page
   

- Advertisement -