Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Start time and End time

Hi everyone,

I want to count item in mintute series, and i have to colum start time and end time.

Which means i can find how many item in 8:46-8:47, or 8:50-8:51.

How to write DAX to show this, please help me,thanks.

Brs,

Dora.

  • Hi Anonymous  ,

     

    I think you want something like this.

    Create a Time interval table by the expression below. Interval time is 30 min

    Time = GENERATESERIES(TIME(0,0,0),TIME(23,59,59),TIME(0,30,0))

     

    Creat a measure like the following:

     

    Measure =
    COUNTROWS (
        FILTER (
            'Table',
            TIMEVALUE ( [Start] ) < SELECTEDVALUE ( 'Time'[Start] )
                && TIMEVALUE ( [End] ) > SELECTEDVALUE ( 'Time'[End] )
        )
    )
    

     

     

    The final reault:

     

     

     

    Pbix in the end you can refer.

    Best Regards

    Community Support Team _ chenwu zhu

     

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

3 Replies

  • Anonymous , Based on what I got

    A new column

    datediff([Starttime],[endtime], minute)

  • v-chenwuz-msft's avatar
    v-chenwuz-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous  ,

     

    I think you want something like this.

    Create a Time interval table by the expression below. Interval time is 30 min

    Time = GENERATESERIES(TIME(0,0,0),TIME(23,59,59),TIME(0,30,0))

     

    Creat a measure like the following:

     

    Measure =
    COUNTROWS (
        FILTER (
            'Table',
            TIMEVALUE ( [Start] ) < SELECTEDVALUE ( 'Time'[Start] )
                && TIMEVALUE ( [End] ) > SELECTEDVALUE ( 'Time'[End] )
        )
    )
    

     

     

    The final reault:

     

     

     

    Pbix in the end you can refer.

    Best Regards

    Community Support Team _ chenwu zhu

     

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