Forum Discussion

davehardikkumar's avatar
3 years ago
Solved

Slice by Hour

Hello,   I have live conneciton and I want to fiter the data by hour range like I want to filter after 4.30 pm. I have date and time in one column. How can I create 24 hour filter which would slic...
  • ValtteriN's avatar
    3 years ago

    Hi,

    Here is one way to do this:

    Data:

     

    Dax:

    Filter after 4.30 =
    var _selectedvalue = MAX('Table (30)'[Column1])
    var _hour = HOUR(_selectedvalue)
    var _min = MINUTE(_selectedvalue)
    return

    SWITCH(TRUE(),
    _hour>=17,1, //check for after 17  
    _hour>=16 && _min >= 30, 1, // check for 16:30-17
    0) //if not these then 0

    End result and explanation:

     

    Place the measure as a filter like in the picture. Afterthis you can apply relative date filter of 1 day. Since the measure will only allow values after 16.30 (4.30 pm) the result should be like you described.

    I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

    My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/