How do youcompare average time elapsed versus static minute value? - sql-server

My data returns an average run time that needs to be greater than 9 minutes. If it is less than 9 min then the row needs to be highlighted red. Here is one of the various iif statements I have attempted to writer to cover this in the background color expression. In the picture the top two rows should be highlighted in red.
=iif(Fields!AvgTime.Value < TimeValue("00:09:00"),"#ffb3be","#c8ffcd")

Related

SSAS MDX - specifying calculated measure values

I want to have an output of people with grade greater than 4.75 in the last 3 months. I managed to have this output in the browser:
It would be ok if I had grades greater than 4.75, but I have all values. How do I specify what values I want to have as an output? It's worth mentioning that sredniaOcenaKelnera is a calculated value from Ocena - Usluga Obslugi measure. Calculation looks like this:
UPDATE
I was trying to write the following color expression:
IIF([Measures].[sredniaOcenaKelnera] > 4,75, 32768 /*Green*/, 0 /*Black*/)
But for some reason it doesn't work. Values above 4,75 doesn't appear green

SSIS Percentage sampling of 50% split isn't even

I have a stored procedure as a data source run through a RESULTS SET.
The second step is to use percentage sampling to split the data gathered 50/50. One half to go down one output, the remainder down the second output. The end result after some other tasks is two files that get uploaded to two separate destinations.
The source query is gettting 11 rows of data for the days activities in question but the percentage sampling is splitting it as 10 rows down the Trustpilot output and 1 row down the Feefo output.
How can it not understand the concept of 50%? Is there something I'm missing?
According to Microsoft on the documentation page for this task, the specified percentage is not always the only factor in choosing which rows to send to the output.
In addition to the specified percentage, the Percentage Sampling
transformation uses an algorithm to determine whether a row should be
included in the sample output. This means that the number of rows in
the sample output may not exactly reflect the specified percentage.
For example, specifying 10 percent for an input data set that has
25,000 rows may not generate a sample with 2,500 rows; the sample may
have a few more or a few less rows.
If you need a specific number of rows, you could use the Row Sampling Transformation. In this case, you'd want to get a row count of the data set and then use an expression to set the number of rows property of the Row Sampling Transformation task equal to half the row count.

Need help finding a logical solution solving a problem

Given the variable 'points' which increases every time a variable 'player' collects a point, how do I logically find a way to reward user for finding 30 points inside a 5 minutes limit? There's no countdown timer.
e.g player may have 4 points but in 5 minutes if he has 34 points that also counts.
I was thinking about using timestamps but I don't really know how to do that.
What you are talking about is a "sliding window". Your window is time based. Record each point's timestamp and slide your window over these timestamps. You will need to pick a time increment to slide your window.
Upon each "slide", count your points. When you get the amount you need, "reward your user". The "upon each slide" means you need some sort of timer that calls a function each time to evaluate the result and do what you want.
For example, set a window for 5 minutes and a slide of 1 second. Don't keep a single variable called points. Instead, simply create an array of timestamps. Every timer tick (of 1 second in this case), count the number of timestamps that match t - 5 minutes to t now; if there are 30 or more, you've met your threshold and can reward your super-fast user. If you need the actual value, that may be 34, well, you've just computed it, so you can use it.
There may be ways to optimize this. I've provided the naive approach. Timestamps that have gone out of range can be deleted to save space.
If there are "points going into the window" that count, then just add them to the sum.

Setting the data step property of shield ui

I am trying to set a datetime X axis for my Shield UI Chart, but am some confused about the data step. I need to have a one day increments, but I see:
dataStep: 24 * 3600 * 1000
I assume, that 24*3600 are the seconds for the day, but what is the 1000 multiplier used for?
You are correct, but are forgetting, that the chart is taking into account milliseconds, instead of seconds. Therefore one day is not only 24*3600 seconds, but 24*3600*1000 milliseconds. This will give you one day increment on your X axis.

Adding multiple rules for indicators SSRS BIDS

I have produced a report which allows you to drill down into the table you see with ticks and crosses. Each tick indicates that a task is complete. In the second picture you can see the rules which dictate whether the task is classes as complete or incomplete and they are the following:
If Remaining Hours = 0 then the task is complete and therfore a tick appears.
If Remaining Hours is between 0.01 and 1,000,000 then there is still work to be carried out and therfore the task is not complete.
The oversight on this the 'Total Effort' column, if this is 0.00 and remaining Hours is also 0.00 then it means that the task has not began yet and is therfore incomplete however due to my rules, a tick is appearing next to these unstarted tasks.
My question is, how do I add a second ruling to take into account 'Total Effort' because as far as I can see I am only able to select one value from the drop down box and then populate just for that.
The rules need to be:
If Remaining Hours = 0 and Total Effort >= 0.01 then a green tick
If Remaining Hours is between 0.01 and 1,000,000 then a red cross
If Total Effort = 0.00 and Remaining Hours = 0.00, then red cross
Hope this makes sense.
=iif(Sum(Fields!EffortRemaining.Value) =0 and Sum(Fields!TotalEffort.Value) >= 0.01,1,0) for value expression
Then tell red cross for 0 and green tick for 1

Resources