web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Displaying result of a...
Power Apps
Answered

Displaying result of a SQL query

(0) ShareShare
ReportReport
Posted on by 101

I have a SQL Server data source named [dbo].[tmtrak_dev_records] with the field 'activityHours'. I'd like to display the result of the following query as a Label:

 

SELECT SUM(activityHours)
FROM dbo.tmtrak_dev_records
WHERE activityDate = '2021-02-22' AND submittedBy = 'user@email.com'

 

Where the activityDate value is the result of:

 

Today() - (Weekday(Today(), StartOfWeek.Monday) - 1)

 

and the submittedBy value is the result of:

 

User().Email

 

We intend to use this PowerApp as a Time-Tracking tool for our department. This query result would display how many hours a user has logged for for each day of the week (Monday in this example).

 

I'm struggling however with getting this to work, and figuring out if it can be done at all. I have tried various things unsuccessfully, and am just hitting a wall with this.

 

Any help is greatly appreciated.

Categories:
I have the same question (0)
  • Verified answer
    alex93jansen Profile Picture
    101 on at

    Nevermind, I found the solution myself. The following code retrieves all record for Monday (of the current week) for the current user, Sums the activityHours field and displays it as "x.xx / 8.00 hours logged"

    Concatenate(
     Text(
     Sum(
     Filter(
     '[dbo].[tmtrak_dev_records]',
     submittedBy = User().Email,
     activityDate = Today() - (Weekday(Today(), StartOfWeek.Monday) - 1)
     ),
     activityHours
     )
     ),
     " / 8.00 hours logged"
    )
  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @alex93jansen :

    Glad to hear that you have solved this problem.

    Please consider marking your solution to a "Solution" to help others.Thanks.

    Best Regards,

    Bof

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 379 Most Valuable Professional

#2
11manish Profile Picture

11manish 203 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard