Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

Tracking time based on conditions



I have tried to look this up but I cant seem to find an answer to this.


I want to have an app where I can input if light are on or off in different rooms of my house. For example I can select living room light and select between on/off. Easy enough, the thing I cant seem to figure out is how I can track how many days in a year a light has been on/off. For example I want to be able to see that in 2022 my living room lights have been on 20 days and off 13 days and in the end of the year I can see that the lights have been on 300 days and off 65 days. Is there a way to track this via power apps and have an output to sharepoint?


Thanks in advance 🙂

Super User
Super User

Okay... There is a way. You can use function Now() to egt the actual date and time.


Imagine that you have a Sharepoit list, you select a button to start counting the time and on that button you have a function Patch() to craete the item. After that you have a "Turn off lights" that will update that item with Now()

After that, you can use DateDiff and check how much time it was on.

Check this 3 functions:


If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!

Best regards,
Gonçalo Nogueira

Check my LinkedIn!

Check my User Group (pt-PT)!

Last Post on Community

My website!

Regular Visitor

Hello, thank you for the answer!


I tried that solution but ended up going in another direction where I used Power Automate to duplicate the items in the with todays date, that way it creates a sort of log for the status of each light. The rest of the calculations I can use power BI for.


Again, thank you for the answer 🙂 

Helpful resources

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (3,441)