PowerApps: getting most recent record having a condition - sharepoint

Is it possible in PowerApps to get at the latest record, from a SharePoint list, having a certain condition?
In my case I know how to get the number, using something like this:
CountIf(Applications, Status = "Pending")
But, I would also like to get the most recent one of them. Well I suppose that would imply two conditions where the second is a Date column, but is it possible to sort it and then pick the first? Grateful for any guidance...

Yes, you can use an expression that sorts the filtered data source by the date in descending order, and take the first element, like in the expression below:
First(
SortByColumns(
Filter(Applications, Status = "Pending"),
"DateColumn",
Descending))

Related

How can I do a work order drawdown in excel?

I know drawdown isn't the correct word, but I also don't know the correct word to use so if you know it tell me as well please.
What I'm trying to do is for a list of open work orders, apply an incoming PO to fill that work order, and then when the quantity in that first PO is exhausted roll to the next PO. I have tables that look similar to these, although the order of the columns can change if need be. Typically the order of the work orders are sorted in date order, as well as PO. Double points if this can be achieved without using VBA, and could just be a formula. Helper columns and tables are also fine. thanks!
then my PO's are something like this
and I would like the result to look something like this (although the remaining column isn't necessary, it would be helpful)

Multi LookUp - Check for unique values

I´m trying to set up unique values in my PowerApp-Form. The data is stored in a Sharepoint list. I have a column called watches, items in this column have a unique number, which have to be unique. People can pick multiple of those watches in a LookUp-field. But before submitting the form, I need to check if those picked values already exist in my list and at least display an error message.
I have setup a regular text field and added following rule to it:
If(LookUp(MyList.Watches;DataCardValue4.SelectedItems.Value in Watches;"OK")<>"OK";"No Error";"Watch already exist")
DataCardValue4 is my LookUp field, where people can pick those watches. With this rule I want to check if a item already is in my column watches and let my text field display the error. Somehow the rule doesn´t work.
Can you tell me how I compare multiple lookup choices to my table/column entries?
The first parameter to the LookUp function should be the table (SharePoint list) rather than the column. So the first parameter should be 'MyList' rather than 'MyList.Watches'. Also, I'm not sure that the formula provided (second parameter to LookUp) will work. In your formula, you will be looking for multiple items (DataCardValue4.SelectedItems.Value) within multiple items (Watches). Perhaps you can update your app to have users only pick one watch value before submitting?
One last thing to note. I'm not sure how big you expect your SharePoint list to get, but I would highly recommend keeping your LookUp formula within the bounds to support delegation. More specifically, SharePoint has different formula requirements than other connectors. For example, you can use '=' in your formula, but not 'in'.
Your new rule might look something like below. Please note that it could have syntax errors and might not even be delegable in it's current form since I am providing the rule with no checking. Also, I switched from using LookUp to using Filter instead just because I'm more familiar with Filter. However, both functions are very similar.
If(CountRows(Filter(MyList; DataCardValue4.Selected.Value = Watches)) > 0; "Watch already exist"; "No Error")

Display multiple results using an Nested if statement

Display multiple results using an Nested if statement.
Is there a way to display multiple results from a nested if statement? or how do i change it to do so.
I am currently using:
=IF(H3="Yes",D3,IF(AD3="Yes",E3,IF(AZ3="Yes",F3,"None")))
If more than one is yes I would like to display both results.
Would I need to create a long IF(AND( statement including all of the possible outcomes or does someone know a quicker way ??
The order in your formula is incorrect.
First you need to check all the ANDs and then you can check for the single occurrences. So, your formula should start with
=if(AND(H3="Y‌​es";AD3="Yes";AZ3="Yes");D3&E3&F3);if(and(H3="Y‌​es";AD3="Yes");D3&E3...
and towards the end of your formula you are adding the single checks
if(H3="Yes",D3,if(AD3="Yes",E3,...

How to find when two goals are achieved and return date?

I have two list of numbers and a date field. I am trying to return the date when a condition for each field is met. I have List A that tracks X and is increasing every week and the goal is 30,868 and then List B tracks Y and is also increasing every week with a goal of 1,688,888. I would like to find a way to return the date that both conditions are satisfied. What is the way to go about doing this? I am able to do it individually for each using Index/Match, but is there a way to use it to return the date that both goals are met? I am using Excel 2010.
Formulas:
=INDEX($B$1:$B$288,MATCH(TRUE,$B1:$B$288>30868,0))
=INDEX($D$1:$D$288,MATCH(TRUE,$D1:$D$288>1688888,0))
Lists
Individual Formula/Example
Assuming that whenever one reaches the goal first it doesn't lose any could you not use what you have in terms of index/match and get the address of the corresponding date field and then the value of that.
Then just compare that with the other index/match.
If you post your existing formula then it'd be relatively easy for another user to then help you get the corresponding date.

Duplicate Based on Multi-Coulmn - Only Keep the Earliest and Latest Value

Below is an example of an Excel sheet I'm working with:
Basically, I'm trying to delete the duplicate rows by matching ID, Date and Type. If ID, Date and Type are the same, then, I want to only keep the record with the earliest Time in case of Type = In and the latest Time in case of Type = Out.
So, for example, in the case of ID = 1, there are 3 records for In, I only want to keep the one where Time is: 8:01 as this is the earliest. The other 2 records should be deleted.
Similarly, in the case of ID 3, I want to keep the record where Time = 18:05 as this is the later time out of the 2.
Can this be achieved by Conditional Formatting or is it more complex than that?
Many thanks for your help in advance.
Conditional Formatting does not to me look the best approach. Depending upon how often required (frequently, and VBA may be better) I suggest:
Add a sequential index (so can be sorted back to original order, if required).
Sort on Time (Smallest to Largest) within Type.
Select Type Out and sort Largest to Smallest.
Select all, in Remove Duplicates uncheck all but Name, Date and Type and OK.
Resort and delete index, if desired.

Resources