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 / Group data by month an...
Power Apps
Suggested Answer

Group data by month and year with fetchXML not working in Power Automate

(1) ShareShare
ReportReport
Posted on by 635
Hi,
I'm trying get the information how often each users logged into a specific environment each month. To do this I created a flow, which get the access information from the audit history and combines it with the user data. I'm doing all of this with a fetchXml statement.
 
I want to group the data by user, year and month, but the aggregate for the date is not working. In the "Day" field it simply shows the timestamp and the aggregate count is always 1.
 
Here is the fetchxml:
<fetch aggregate='true' mapping='logical' version='1.0' distinct='false'>
  <entity name='audit'>
    <attribute name='createdon' alias='Year' groupby='true' dategrouping='year' />
    <attribute name='createdon' alias='Day' groupby='true' dategrouping='day' />
    <attribute name='auditid' alias='Total' aggregate='count' />
    <filter type='and'>
      <condition attribute='operation' operator='eq' value='4' />
      <condition attribute='createdon' operator='ge' value='2024-01-01T00:00:00.000Z' />
    </filter>
    <link-entity name='systemuser' from='systemuserid' to='objectid' link-type='inner' alias='user'>
      <attribute name='domainname' alias='UPN' groupby='true' />
    </link-entity>
  </entity>
</fetch>
What may be the issue here?
  • MichaelFP Profile Picture
    2,008 Moderator on at
    Hello. I tested here it is look like an issue with date and time field on Audit table, it looks that is not threating as Date and time the field created on. it only showing the full date and time when retrieve the data.
     
    I tested with account with the created on and it worked.
     
    I would recommend to open a ticket with Microsoft to check that.
  • Suggested answer
    Shashank Bhide Profile Picture
    946 Moderator on at
  • Ravindra Jadhav Profile Picture
    342 Moderator on at
     
    Please Closed the Question, Mark it Solved 
     
    If my answer helped resolve your issue, please consider marking it as solved to assist others facing the same problem. Additionally, giving it a like would be greatly appreciated and motivates us to keep helping
     
    Thank You
    Ravindra Jadhav

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 239

Last 30 days Overall leaderboard