SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 How to do this in SSRS expression
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Villanuev
Constraint Violating Yak Guru

447 Posts

Posted - 08/14/2013 :  23:19:26  Show Profile  Reply with Quote
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


Edited by - Villanuev on 08/14/2013 23:21:03

Villanuev
Constraint Violating Yak Guru

447 Posts

Posted - 08/15/2013 :  05:59:51  Show Profile  Reply with Quote
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

447 Posts

Posted - 08/15/2013 :  23:14:54  Show Profile  Reply with Quote
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

Edited by - Villanuev on 08/15/2013 23:16:35
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 08/16/2013 :  14:07:48  Show Profile  Reply with Quote
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

India
52325 Posts

Posted - 08/16/2013 :  14:11:06  Show Profile  Reply with Quote
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

547 Posts

Posted - 08/16/2013 :  14:29:57  Show Profile  Reply with Quote

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;

Go to Top of Page

Villanuev
Constraint Violating Yak Guru

447 Posts

Posted - 08/19/2013 :  20:58:46  Show Profile  Reply with Quote
Thank you very much guys.

Edited by - Villanuev on 08/19/2013 21:04:08
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000