Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

filtering timebins

Hi  So i have a massive dataset, that needs to be split up into bins. It is login times on an app. What i need is to know, in a 15 minutes interval, how many were online. However, i cannot get my me...
  • v-alq-msft's avatar
    6 years ago

    Hi, Anonymous 

     

    Based on my research, I created data to reproduce your scenario.

    DateTime bins Table:

     

    DateTime bins Table = 
    SELECTCOLUMNS(
        GENERATE(
            CALENDAR(MIN('Table'[enddatetime]),MAX('Table'[enddatetime])),
            GENERATESERIES(
                TIME(00,0,0),
                TIME(23,59,0),
                TIME(0,15,00)
            )
        ),
        "Datetime",[Date]+[Value],"Date",[Date],"Time",[Value]
    )

     

     

    Table:

     

    Then you may create two measures as follows.

     

    IsCount = 
    var _currentmax = SELECTEDVALUE('DateTime bins Table'[Datetime])
    var _currentmin = SELECTEDVALUE('DateTime bins Table'[Datetime])-1/24/4
    
    var _currentstart = MAX('Table'[startdatetime])
    var _currentend = MAX('Table'[enddatetime])
    return
    IF(
        NOT(
            OR(_currentstart>_currentmax,_currentend<_currentmin)
        ),
        1,0
    )
    
    CountNumber = 
    IF(
        HASONEVALUE('DateTime bins Table'[Datetime]),
        COUNTROWS(
            FILTER(
                'Table',
                [IsCount] = 1
            )
        ),
        0
    )

     

     

    Finally you can use the 'DateTime' column to as a slicer to filter how many 'id_details' between the corresponding datetime and 15 minutes before the datetime.

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • v-alq-msft's avatar
    v-alq-msft
    6 years ago

    Hi, Anonymous 

     

    You may create a table visual with the Datetime column from DateTime ins Table and drag the 'CountNumber' measure into the visual.

     

    Here is the result. You can also use the highlight filter to see the detailed result.

     

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.