Skip to main content

Hi All,

 

I'd like to add a button to my sheet that allows the user to automatically filter for the last 7 days, and a separate button that allows the user to filter for the last full week. Bookmark selection doesn't seem to work, since the bookmarks are static.

Thanks!

Hi @ward.brand ,

 

I don't think this is possible with a button but you can do it with an OLAP table.

 

You can use this PQL as dimension:

CASE WHEN DAYS_BETWEEN ("CASE_TABLE"."created", TODAY()) < 8 THEN 'Last 7 Days' ELSE 'Older than 7 Days' END

For the KPI just use a normal case count.

 

Then you can filter on the Last 7 Days.

Similarly you can create the same for the calendar week.

 

Let me know if this works! :)


Hi @ward.brand ,

 

I don't think this is possible with a button but you can do it with an OLAP table.

 

You can use this PQL as dimension:

CASE WHEN DAYS_BETWEEN ("CASE_TABLE"."created", TODAY()) < 8 THEN 'Last 7 Days' ELSE 'Older than 7 Days' END

For the KPI just use a normal case count.

 

Then you can filter on the Last 7 Days.

Similarly you can create the same for the calendar week.

 

Let me know if this works! :)

Hi @1460067637 ,

 

Thanks for your reply! The workaround with the OLAP-table works. It's unfortunate that it's not possible with a button though... Thanks for your help!

 

Kind regards, Ward


Hi Ward, to add to what my colleague mentioned above: it is possible with a workaround. We discussed it and came up with the following solution/workaround to actually be able to use buttons:

 

  1. Create a variable (test/replacement type): I will refer to it as "sheet_filter1"
  2. Create 3 buttons: (1) "Last 7 days", (2) "Last full week", (3) "Reset"
    1. Screenshot 2022-06-30 at 11.48.05
  3. Now we will add the PQL filter statements to the buttons. Therefore, we open each button 1 by 1, select the button action "set variable", select the variable "sheet_filter1", and copy and paste the PQL Filter below
  4. Button "Last 7 days": FILTER "TABLE"."DATE_TIME" >= ADD_DAYS(TODAY(), -7);
  5. Button "Last full week": FILTER "TABLE"."DATE_TIME" BETWEEN ROUND_WEEK(ADD_DAYS(TODAY(), -7)) AND ROUND_WEEK(TODAY());
  6. Button "Reset": ;
  7. Example screenshot for the "Last full week" button:
    1. Screenshot 2022-06-30 at 11.46.42
  8. The last step is to add the variable "sheet_filter1" via the setting to the sheet filter with the "load script" option:
    1. Screenshot 2022-06-30 at 11.47.50

 

Now you are good to go.

 

If you have any other questions, feel free to ask Lorenco or me! 😊


Hi Ward, to add to what my colleague mentioned above: it is possible with a workaround. We discussed it and came up with the following solution/workaround to actually be able to use buttons:

 

  1. Create a variable (test/replacement type): I will refer to it as "sheet_filter1"
  2. Create 3 buttons: (1) "Last 7 days", (2) "Last full week", (3) "Reset"
    1. Screenshot 2022-06-30 at 11.48.05
  3. Now we will add the PQL filter statements to the buttons. Therefore, we open each button 1 by 1, select the button action "set variable", select the variable "sheet_filter1", and copy and paste the PQL Filter below
  4. Button "Last 7 days": FILTER "TABLE"."DATE_TIME" >= ADD_DAYS(TODAY(), -7);
  5. Button "Last full week": FILTER "TABLE"."DATE_TIME" BETWEEN ROUND_WEEK(ADD_DAYS(TODAY(), -7)) AND ROUND_WEEK(TODAY());
  6. Button "Reset": ;
  7. Example screenshot for the "Last full week" button:
    1. Screenshot 2022-06-30 at 11.46.42
  8. The last step is to add the variable "sheet_filter1" via the setting to the sheet filter with the "load script" option:
    1. Screenshot 2022-06-30 at 11.47.50

 

Now you are good to go.

 

If you have any other questions, feel free to ask Lorenco or me! 😊

@ward.brand 


Hi Ward, to add to what my colleague mentioned above: it is possible with a workaround. We discussed it and came up with the following solution/workaround to actually be able to use buttons:

 

  1. Create a variable (test/replacement type): I will refer to it as "sheet_filter1"
  2. Create 3 buttons: (1) "Last 7 days", (2) "Last full week", (3) "Reset"
    1. Screenshot 2022-06-30 at 11.48.05
  3. Now we will add the PQL filter statements to the buttons. Therefore, we open each button 1 by 1, select the button action "set variable", select the variable "sheet_filter1", and copy and paste the PQL Filter below
  4. Button "Last 7 days": FILTER "TABLE"."DATE_TIME" >= ADD_DAYS(TODAY(), -7);
  5. Button "Last full week": FILTER "TABLE"."DATE_TIME" BETWEEN ROUND_WEEK(ADD_DAYS(TODAY(), -7)) AND ROUND_WEEK(TODAY());
  6. Button "Reset": ;
  7. Example screenshot for the "Last full week" button:
    1. Screenshot 2022-06-30 at 11.46.42
  8. The last step is to add the variable "sheet_filter1" via the setting to the sheet filter with the "load script" option:
    1. Screenshot 2022-06-30 at 11.47.50

 

Now you are good to go.

 

If you have any other questions, feel free to ask Lorenco or me! 😊

This is exactly what I was looking for, thank you both so much! @1460017979 @1460067637 


Reply