How to get middel value from three raw result of query to buld report

DM 1 Reputation point
2021-08-06T21:20:31.247+00:00

I am looking to get the second raw value from my query result which has 3 raw

my result is

Apoint 25
Bpoint 31
Cpoint 50

I want to read 31 and assign that to variable in my SSRS report to and check if first raw and third raw value is within 10 or not. In my final report, I want to calculate a difference of 31-25 if this is less than 10 then I like to put text next to 25 in range if it is greater than 10 then put out of range so the final should look like as below

Apoint 25 In Range
Bpoint 31 In Range
Cpoint 50 Out of Range

and if any value is out of range then I like to send out an email to users using SSRS report subscription. this report can run on schedule.

Can some please help I am new to SSRS

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,951 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,665 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Joyzhao-MSFT 15,596 Reputation points
    2021-08-09T05:55:17.133+00:00

    Hi @DM ,
    If I understand correctly, you need to create a variable. In this case, assign the variable to "31" and compare the variable with the first and third values. The absolute value <=10 is "In Range", >10 is "Out of Range".

    1. Create a variable named "PointValue"
      121488-02.jpg
    2. Use IIF expression to filter the values that meet the conditions, and display "In Range" or "Out of Range". =IIF(ABS(Variables!PointValue.Value-Fields!Value.Value)<=10,"In Range","Out of Range")

    121555-03.jpg
    3. Preview:
    121576-04.jpg
    Regarding the subscription part, you could check the following link to learn Standard and data-driven subscriptions: Subscriptions and Delivery (Reporting Services).

    Best Regards,
    Joy


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Joyzhao-MSFT 15,596 Reputation points
    2021-09-08T02:03:10.95+00:00

    Good morning @DM ,
    Has your issue been resolved? If you have any questions, please feel free to let me know.

    Regards,
    Joy

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.