Date Filter for last day/week/month

I have a dataset. I want to create a Filter Date Card which has options such as "Today","Yesterday","Last one week", "Last one month". 


Can anyone tell how I can create this?

Best Answer

  • hamza_123
    hamza_123 🟠
    Answer ✓

    For everyon's knowledge, you can do this by going into the calendar type card, going to Presets View in Chart Properties and selecting "Show Presets Only". 


    This will do the job. Cheers


  • At first glance I thought this was pretty straightforward. Then I started writing my solution and realized an issue. For today and yesterday you can just write a calculated field statement like this:

    case when `date_field`=curdate() then 'today'

    when `date_field`=curdate()-1 then 'yesterday' end


    however, the issue I discovered is that you would want to include yesterday and today in the 'last one week' category. 

    if you are just looking at one card, I know that you can click on the date and quickly adjust the date window the card is looking at but I am not sure if that is possible from a dashboard layout. This might be a feature request. 

    “There is a superhero in all of us, we just need the courage to put on the cape.” -Superman
  • Hello. 


    I was watching a video on Youtube, in which a guy creates a "last 3 months" filter. Although I could not completely understand what he did, do you think using this feature (highlighted in the video) I can make my filter?