cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Continued Contributor
Continued Contributor

Checking value of all records

Hi all,

 

I have a datasource table like the one below. Note that the first row in capital letters is the result I want to get from checking the values in the table below it.  The table consists of 2 columns: 'TaskName' and 'Status'. In the image below I placed the 3 possibilities of table values. Either all tasks are not started (middle), either completed (right) or none of the previous both (left). The tasks with 'Not Applicable' should be ignored for checking the result, just like they wouldn't exist in the table.

Capture.PNG

 

So I would like to check for the total status of all tasks. How do I run over all records and get a result from there that returns either value or compare it to a value on which I can determine what the total status is? I'm open for any idea.

 

Many thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Continued Contributor
Continued Contributor

Re: Checking value of all records

Found a solution

 

UpdateContext({vStatus: ""});
Switch(
    true,
    CountRows(Distinct(Filter(colTasks, InspectionId = galINSInspections.Selected.Id), Status)) = 1 
    && First(Distinct(Filter(colTasks, InspectionId = galINSInspections.Selected.Id), Status)).Result = "Not Started",
    UpdateContext({vStatus: "Not Started"}),
    CountRows(Distinct(Filter(colTasks,InspectionId = galINSInspections.Selected.Id), Status)) = 1 
    && First(Distinct(Filter(colTasks, InspectionId = galINSInspections.Selected.Id), Status)).Result = "Completed",
    UpdateContext({vStatus: "Completed"}),
    UpdateContext({vStatus: "In Progress"})
);

View solution in original post

1 REPLY 1
Highlighted
Continued Contributor
Continued Contributor

Re: Checking value of all records

Found a solution

 

UpdateContext({vStatus: ""});
Switch(
    true,
    CountRows(Distinct(Filter(colTasks, InspectionId = galINSInspections.Selected.Id), Status)) = 1 
    && First(Distinct(Filter(colTasks, InspectionId = galINSInspections.Selected.Id), Status)).Result = "Not Started",
    UpdateContext({vStatus: "Not Started"}),
    CountRows(Distinct(Filter(colTasks,InspectionId = galINSInspections.Selected.Id), Status)) = 1 
    && First(Distinct(Filter(colTasks, InspectionId = galINSInspections.Selected.Id), Status)).Result = "Completed",
    UpdateContext({vStatus: "Completed"}),
    UpdateContext({vStatus: "In Progress"})
);

View solution in original post

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (8,405)