Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Filter Date with Buttons

Hi,    I really need help to create exactly the same thinng on this screenshot.  The requirement is the user when click on the button report should dipslays selected time period.  Even if I need to...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    Step1: Create a table like below and use it as slicer.

    Step2: Create a measure as below and add it to visual filter.

    Measure = 
    var _time = SELECTEDVALUE('Table'[Time])
    var _period = SELECTEDVALUE(Slicer[period])
    return
    SWITCH(_period,"month",IF(_time>=EDATE(TODAY(),-1)&&_time<=TODAY()+1,1,0),
            "week",IF(_time>=TODAY()-7&&_time<=TODAY()+1,1,0),
            "12H",IF(_time>=TODAY()-2/24&&_time<=TODAY()+1,1,0),
            "24H",IF(_time>=TODAY()-1/24&&_time<=TODAY()+1,1,0))

    Step3: Set filter value = 1.

     

    Best Regards,

    Jay