Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Grouping date times that are within a minute of the value above

Hi All,

 

Here's a screenshot of my data.

 

cptcherry_0-1643067293373.png

 

I want to group the data where the DateTimeDT is within 2 minutes of the logged time.

I tried to do this by removing the seconds from the entry (with the column DateTime), but some entries occur in the next minute frame.

 

Would you do this in Powery Query or Dax?

I have another question but I'll post it separately.

 

 

1 REPLY 1
edhans
Super User
Super User

You should create another column that looks at the difference using Duration.TotalSeconds:

Duration.TotalSeconds([Time] - [Log])

 

edhans_0-1643127646194.png

That will return the difference in seconds and anything less than or equal to 120 is what you want. You can then wrap that in an if/then/else clause and return true or false, or whatever, and group by that. When you group, you may want to use the GroupKind.Local optional 3rd parameter of the Table.Group function. You will need to add it manually in the formula bar after doing the group by. It will group on each change in true/false, not all true/false into two massive groups.

If that isn't what you want, please be more clear, and give us data to work with.

How to get good help fast. Help us help you.

How To Ask A Technical Question If you Really Want An Answer

How to Get Your Question Answered Quickly - Give us a good and concise explanation
How to provide sample data in the Power BI Forum - Provide data in a table format per the link, or share an Excel/CSV file via OneDrive, Dropbox, etc.. Provide expected output using a screenshot of Excel or other image. Do not provide a screenshot of the source data. I cannot paste an image into Power BI tables.

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.