How do I write a TFS 2010 Work Item query clause whos value is a field value? - wiql

I think this question may be spawned from lack of knowledge, but here we go...
I am trying to write a new team query (using the new query option of team explorer, in VS 2010) what I want is fairly simple; essentially a list of work items whos [Completed Work] value exceeds the [Original Estimate] field value. In other words WIs that have exceeded their original estimates.
The VS 2010 view does not seem to have an option to show the WIQL being generated under the hood, so I'll have to describe what I have done/am trying to do via the VS 2010 UI.
Clauses are fairly standard to start;
Team Project = #Project
And Work Item type = Task
And State = [Any]
I have added a caluse (to remove any work items without an estimate)
And Orignial Estimate <> ''
I thought the next step would be simplicity itself; adding a clause along the lines of
And Completed Work > Original Estimate
But no matter how I try to write "Original Estimate" in the value filed of the UI (as Original Estimate, [Original Estimate] and many other variations) to date all I get is a line indicating a that Input string was not in a correct format.
Is this possible? I would have thought simple comparisons to the value of another WI field would be supported, are they? If it is possible what the he** is the syntax?
Thanks.
Update
I had a look at the Task template and confirmed that both Original Estimate and Remaining Work are doubles and have the following full names (should that be relivant)
Friendly Name Type Ref Name
Original Estimate Double Microsoft.VSTS.Scheduling.OriginalEstimate
Remaining Work Double Microsoft.VSTS.Scheduling.RemainingWork

You simply need the >= [Field] operator instead of the >= operator:
Original Estimate >= [Field] Completed
Work

Related

Filter amazon personalize availability based on a date range and stock on hand ( nullable value )

I have around 500K items whose availability depends on the stock on hand and the availability date( available_on and discontinue_on ). I want to filter unavailable items from the recommendation, I expect something like this:
Include
Items.available_on <= $now AND
(Items.discountinue_on IS NULL OR Items.discountinue_on > $now ) AND
Items.stock_on_hand > 0
however, I could not figure out how to write the about expression in aws personalize filter.
Update
Dynamic filters now support range operators (i.e., <, <=, >, >=). However, IS NULL and grouping operators like parentheses are not supported. Therefore, the discontinue_on field should be populated with a valid date or a date in the extreme future for products that cannot be discontinued. The filter statement would then look something like this.
INCLUDE ItemID WHERE Items.available_on <= $now AND Items.discountinue_on > $now AND Items.stock_on_hand > 0
Below is the relevant portion of the prior answer that is still applicable but may be less ideal than the solution above.
There are a couple alternative approaches that will also work. First, you can use a single field in your items dataset that indicates whether the item is available or not (e.g., is_available). So a true/false value that represents the current state of 1/ being available, 2/ not discontinued, and 3/ with stock on hand. This means your application needs to update this flag for items when their availability status changes. In other words, when the item is discontinued or out of stock, change its is_available field value to false. This can be done using the PutItems API. Your filter becomes much simpler.
INCLUDE ItemID WHERE Items.is_available = "true"
Another approach would be to keep the available_on, discontinue_on, and stock_on_hand in your items dataset and filter expression but replace $now to a fixed/hard-coded value.
INCLUDE ItemID WHERE Items.available_on <= 20211105 AND Items.discontinue_on > 20211105 AND Items.stock_on_hand > 0
where 20211105 is the current date in YYYYMMDD format. You can add hours, minutes, seconds for more granularity. Of course, this means that the datetimes in your filter expression need to be regularly updated. This requires periodically creating a new filter with updated datetimes, switching your app to use the new filter, and then deleting the old filter. Essentially rotating your filter over time. This serverless app can make this process much easier.
https://github.com/james-jory/amazon-personalize-filter-rotator

Perform analysis on last three values of a FileMaker dataset

My end goal is to have a box change color when the last 3 records input into a field (based on the time of input) in FileMaker achieve a certain criteria (ex. variance < 2). I would like to know how to make this happen, or how a calculation/script can be written to only look at the last 3 records.
There are several ways you could approach this. A simple one would be to use a script to:
Show all records in the given table;
Unsort them (assuming they were entered in chronological order; otherwise sort them by creation timestamp);
Omit all records except the last three;
Get the value of a summary field defined as Standard Deviation of your value field;
Set a global variable/field to the square of the returned value.
Then use the global variable/field to conditionally format your "box".
If you don't want to use a script, you will have to define a relationship in order to get the last three values in the table, regardless of the current found set and/or sort order. Or you may use the ExecuteSQL() function for this.

Zscore with Rolling Window Panel Data

I am trying to calculate the zscore with Rolling window. I need to actually calculate standard deviation for a 3 year rolling window to calculate z-score. A minimal working example is given below:
use http://dss.princeton.edu/training/Panel101.dta
xtset country year
rolling sd_x1=r(sd), step(1) window(3) saving(sd_x1, replace) keep(year): sum x1, detail
Now after this I need to merge it back with the original file. But the variable year does not appear but a column name date appears with all missing values. I am trying to merge it using the following command:
merge 1:1 country year using sd_x1
However, I get the error that variable year is not found and actually this variable is not kept while running the rolling command. Any help will be much appreciated.
I am always surprised that people have interest or faith in standard deviations based on three values.
A more direct approach would be to use rangestat (SSC). The syntax could be something like
use http://dss.princeton.edu/training/Panel101.dta
xtset country year
rangestat (sd) sd=x1, interval(year 0 2) by(country)
except that I cannot test this at the moment.
The key difference here is that rangestat produces new variables in the current dataset. Search the Statalist archives for examples of rangestat use.
Note that in your example the detail option is unnecessary as summarize by itself produces standard deviations.
You can extend this approach to get the mean at the same time.

SSRS Aggreation on Calculated Field

I am trying to perform an aggregation on a calculated Field in SSRS and am getting the following error:
[rsAggregateReportItemInBody] The Value expression for the textrun 'Textbox43.Paragraphs[0].TextRuns[0]' uses an aggregate function on a report item. Aggregate functions can be used only on report items contained in page headers and footers
This is the formula I tried to use:
=Sum(ReportItems!PlanPurchPrice.Value, "Select_UCPUtilization")
In this Case PlanPurcPrice is also an Expression:
=First(Fields!PawPlanPurchPrice.Value, "Select_UCPUtilization")
Any suggestions on this would be greatly appreciated.
SSRS 2008 does not support the functionality you are looking for unless the report item is located in the header or footer (as is stated in the error message). I would, instead, propose two alternate solutions:
First Option
Place the calculation in your query (if possible) at which point you can then reference the field and the aggregate will work as desired.
Second Option
You essentially want to create the aggregate you're looking to return elsewhere in the report where it is directly connected to the Select_UCPUtilization scope, then reference the aggregated value elsewhere. Follow these steps:
Within the same scope as report item PlanPurchPrice, calculate a sum of the PlanPurchPrice. Name the textbox containing the aggregate something meaningful (e.g., Sum_PlanPurchPrice).
Reference that textbox directly wherever you were trying to use the ReportItems sum before (i.e., =ReportItems!Sum_PlanPurchPrice.Value)
Hide the workaround. Place the aggregate you created in an additional column or row attached to the Select_UCPUtilization scope. Turn the text white, turn off growth and shrinkage, and make the row very tiny (a pixel or two high).
Using the second option, the report item does exist (and is visible, which is important) on the report and contains the sum you are looking to return elsewhere.
Hope this helps. if this doesn't make sense, please reply via comment and I'll help you to the best of my ability.

Get the last date of non-empty value using MDX

Do you know how to get the last non-empty value using mdx query.. then after that.. i want to count how many null values are next to it up to the last date. My main purpose for this is to count how many days a customer has no transaction..
i have to make a report in ssrs (using adventure works cube) that counts how many days a customer has no transaction..
thanks..
Use this article to obtain set of non empty dates.
To obtain count you can:
Use member properties (day of year or something more suitable in
this case) and just subtract one value from another.
You can find
last date with non empty value, previous one using LAG(1), include
them to the next construction {prev.date:last.date} and use COUNT
for set
Recently I follow this article, It really helps me.
The most important part is to understand scope usage.
Even If you don't have an Enterprise Edition, you can use it.