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 2008 Forums
 Analysis Server and Reporting Services (2008)
 How to do this in SSRS expression

Author  Topic 

Villanuev
Constraint Violating Yak Guru

478 Posts

Posted - 2013-08-14 : 23:19:26
Hi Guys,

I have a query regarding in SSRS.I could not get the correct result set based on the sample report see belowmy requirements. thanks.


1. how to configure in SSRS if the qty divided by 10. the result set is the TOTAL column
a combination of whoel number and with decimal.

2. how to get the numbers before the decimals in SSRS (total no dec)

3. how to validate if total column = total no dec "Not OK" Elese "OK"

4. how to validate the number after decimal. if TOTAL has decimal get the number else 0


QTY----TOTAL-----  TOTAL no dec---remove decimals---validate if no decimal---------if has a decimal get the 
-------------------------------------"not ok" with decimal "ok"-----number else dsiplay zero
-------------------------------------------------------------------------------------
818 ----81.8------------81---------------OK-----------------------------8
427 ----42.7------------42---------------OK-----------------------------7
344-----34.4------------34---------------OK-----------------------------4
260-----26--------------26---------------NOT OK-------------------------0
0-------0----------------0---------------NOT OK-------------------------0
10------1----------------1---------------NOT OK-------------------------0

Villanuev
Constraint Violating Yak Guru

478 Posts

Posted - 2013-08-15 : 05:59:51
What is is equivalent of Mod in T-SQL?
I need to divides two numbers and returns only the remainder. thanks.
Go to Top of Page

Villanuev
Constraint Violating Yak Guru

478 Posts

Posted - 2013-08-15 : 23:14:54
Hi Guys,

How do i get the first numeric values after the decimal points in SQL Query. I tried te MOD dunction and its working in SSRS but instead of using SSRS i went to Query. see sample result. thanks.

QTY WITH DECIMAL---Result

------------------------------

0.600000---6
0.800000--8
NULL--0
0.800000--8
19.500000--5
273.000000--0
0.600000--6
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-08-16 : 14:07:48
quote:
Originally posted by Villanuev

What is is equivalent of Mod in T-SQL?
I need to divides two numbers and returns only the remainder. thanks.


mod is there in SSRS

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-08-16 : 14:11:06
quote:
Originally posted by Villanuev

Hi Guys,

How do i get the first numeric values after the decimal points in SQL Query. I tried te MOD dunction and its working in SSRS but instead of using SSRS i went to Query. see sample result. thanks.

QTY WITH DECIMAL---Result

------------------------------

0.600000---6
0.800000--8
NULL--0
0.800000--8
19.500000--5
273.000000--0
0.600000--6



as per given sample data given this should work


SELECT Qty,Qty-FLOOR(Qty) AS decimalpart
FROM Table


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

MuMu88
Aged Yak Warrior

549 Posts

Posted - 2013-08-16 : 14:29:57
[CODE]
DECLARE @Qty TABLE (val DECIMAL(18,8));
INSERT INTO @Qty VALUES
(0.600000),
( 0.800000),
( NULL),
( 0.800000),
( 19.500000),
( 273.000000),
( 0.600000);


SELECT val, CAST(COALESCE(val -FLOOR(val), 0)*10 as INT) as DecimalPart from @Qty;

[/CODE]
Go to Top of Page

Villanuev
Constraint Violating Yak Guru

478 Posts

Posted - 2013-08-19 : 20:58:46
Thank you very much guys.
Go to Top of Page
   

- Advertisement -