SSRS LOOKUP with a fixed Source Expression - reporting-services

Here is a seemingly simple SSRS Expression that returns #Error...
From this simple dataset we are using the following LOOKUP Expression (which returns #Error).
=LOOKUP("Score1", Fields!RowName.Value, Fields!RowDecile.Value, "ScoreQuotient")
and in this case we want it to return "High"!
DataSet = "ScoreQuotient"
RowName RowQuotient RowDecile
Score1 92 High
Score2 58 High-Medium
Score3 95 High
Score4 66 High-Medium
Score5 8 Low
Score6 85 High
Score7 91 High
Score8 85 High

Related

How to add a loop in SSRS

I am using SSRS 2012 R2.
I need to create a loop in ssrs to calculate the compliance of ONB to LB
but with a condition, for the total bags count <= 100 it will be 27 mins. but for each additional 50 bags add 5 mins.
I tried the code below but it takes only 27 and 34 min. I want to replace 34 with a loop.
count(
iif(Fields!Duration_ONB_LB_.Value <
iif(Fields!Total_Bag_Count.Value <= "100", "27","34") ,1, Nothing))
/ count(Fields!TotalRows.Value) * 100 )
Can you please help me out in this?
I'm not sure if 'loop' is the correct term, I assume you want to just create an expression that adds 5 mins for every 50 bags (or part of).
I created a sample dataset so you can see the results, it assumes that up to 100 bags is 27 mins, 101-150 bags would be 32 mins, 151-200 bags would be 37 mins and so on...
here is the expression I used, you will need to replace the iif(Fields!Total_Bag_Count.Value <= "100", "27","34") part of your expression with this.
IIF
(
Fields!Total_Bag_Count.Value <= 100,
27,
(CEILING((Fields!Total_Bag_Count.Value -100) / 50) * 5) + 27
)
Here are the results

SQL Count, Sum and Group by

I'm trying to create an SQL statement to query a table to count quantity of a product, sum the cost and group by item number and for some reason, i'm having a difficult time.
Here is a sample data file:
**MAKE MODEL COST**
Canon C100 125
HP H100 30
HP H100 30
HP H100 30
Canon C100 150
Xerox X100 125
Xerox X100 125
Xerox X200 125
The results i'm looking for would look like this:
**Model Qty Cost**
C100 2 275
H100 3 90
X100 2 250
X200 1 125
Any help would be appreciated.
Try this answer. This is very basic level Aggregate functionality. Can you please search on the net, you'll get the answer easily:
SELECT MODEL
,COUNT(1) AS QTY
,SUM(COST) AS COST
FROM [Table] GROUP BY MODEL

Grouping and Total on one Column Values

I have this group in a table. Where I need to display one value on the top and rest according to its alphabetical order.
Table
Column1 Value#1 Value#2
Alpha 12 26
Beta 65 745
Gamma 987 87
Pie 7 2
Non-Beta 132 426
Zeta 112 266
How can I display it in the below format...
Table
Column1 Value#1 Value#2
Non-Beta 132 426
Alpha 12 26
Pie 7 2
Zeta 112 266
Total 263 720
Beta 65 745
Gamma 987 87
Total 1057 832
I could display Non-Beta on the top by using the below expression in the sorting tab in the group Property.::
=IIF(Fields!Column1.Value = "Non-Beta", "A" + Fields!Column1.Value, "B" + Fields!Column1.Value)
But how do I Display it according to the above format. Values Come from one column (Column1)
EDIT
This is the output I got after the operation that Ian specified...
Thank you
You can set up a group based on an expression like this:
=IIf(Fields!Column1.Value = "Beta" or Fields!Column1.Value = "Gamma"
, "Group2"
, "Group1")
i.e. if Beta or Gamma, include in one group; everything else gets grouped together.
Include a Header and a Footer row with the group.
Apply the sorting expression to the Tablix as required.
The report will look something like this in the designer:
End results looks like your requirements:

dlookup function in access

I'm first time trying to use dlookup function in access as below but I get blank output.
select dlookup ("quantity","test","series > 2000") from test
This is test table
id series quantity
1 1000 25
2 2000 33
3 3000 44
4 4000 55
5 5000 66
6 6000 77
I thought the above query will display all records from the table below which has series more than 2000 i.e. as below but it displays blank result.
id series quantity
3 3000 44
4 4000 55
5 5000 66
6 6000 77
I'm not sure if my syntax is incorrect or anything else. I already double checked my syntax from various sources though.
DLookup() returns a single value, which is not what I think you want. Just put your selection constraint in the WHERE clause.
SELECT id, series, quantity
FROM test
WHERE series > 2000;

What would be the best practice to store multiple 2 digit dataset in MySql server

Let say i want to store several dataset ie
78 94 33 22 14 55 18 10 11
44 59 69 79 39 49 29 19 39
And later on i would like to be able run queries that will determine the frequency of certain number. What would be the best way to this? What would be table structure to make a fast query.
Please be specific as you can be.
To get the counts, you can run a query such as:
SELECT value, COUNT(*) from table_of_values GROUP BY value
Placing an index on the single integer value column is pretty much all you can do to speed that up.
You could of course also just keep a table with every two-digit value and a count. You will have to pre-fill the table with zero counts for every value.
Then increment the count instead of inserting:
UPDATE table_of_values SET count = count + 1 WHERE value = (whatever)