cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cptcherry
New Member

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
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors