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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Liwi
Frequent Visitor

Group By if time between > 1hr

Hi All,

Hope someone will be able to help me

Is it possible to group in DAX categories if the time in between > 1 hr? I need to return count, max time and min time

 

Appreciate any advice

 

Data:

NameDateTime
A05/05/2018 06:42
A05/05/2018 06:43
A05/05/2018 06:45
A05/05/2018 06:51
A05/05/2018 08:43
A05/05/2018 08:46
A05/05/2018 15:20
A05/05/2018 15:22
A05/05/2018 15:23

 

Expected result:

NameCountMinMax
A405/05/2018 06:4205/05/2018 06:51
A205/05/2018 08:4305/05/2018 08:46
A305/05/2018 15:2005/05/2018 15:23
3 REPLIES 3
Zubair_Muhammad
Community Champion
Community Champion

Hi @Liwi

 

Try this calculated table

From the Modelling Tab>>New Table

 

Table =
VAR temp1 =
    ADDCOLUMNS ( Table1, "Time", HOUR ( Table1[DateTime] ) )
VAR temp2 =
    SUMMARIZE (
        temp1,
        [Time],
        Table1[Name],
        "Count", COUNT ( Table1[DateTime] ),
        "Min", MIN ( Table1[DateTime] ),
        "Max", MAX ( Table1[DateTime] )
    )
RETURN
    temp2

Regards
Zubair

Please try my custom visuals

@Liwi

 

Please see attached file

 

Gropby.png


Regards
Zubair

Please try my custom visuals

Thank you @Zubair_Muhammad

 

However you solution gives me max / min / count for each hour while I need to define the groups for each name where the time difference between lines is more than 1 hour, so the difference of MAX of Group 1 - MIN Group 2 > 1 hour.

Perhaps below ilustrates better. 

Would you know how to achieve that?Capture.PNG

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.