Forum Discussion

Atis112's avatar
Atis112
New Member
3 years ago
Solved

Filter by date and time

Hello,   I would like to ask for help! I would like to set up a dynamic filtering option that would pre-filter the data based on the criteria you specify. The start date is always the previous da...
  • v-yueyunzh-msft's avatar
    3 years ago

    Hi , Atis112 

    According to your description, you want to filter the data from previous day 6am to today 6am.

    Here are the steps you can refer to :

    (1)This is my test data:

    (2)We can create a measure like this:

    Measure = var _today  = TODAY()
    var _previoud_day = TODAY()-1
    var _cur_day =  MAX('Table'[Date]) 
    var _cur_time =   MAX('Table'[Time])
    return
    IF( OR( _cur_day= _today && _cur_time<= TIME(6,0,0) ,  _cur_day= _previoud_day && _cur_time>= TIME(6,0,0) ) ,1,-1)

     

    (3)Then we can put the measure on the visual and configure it:

     

     

    If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

    Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

     

    Best Regards,

    Aniya Zhang

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