Forum Discussion

sylvia_gulubova's avatar
sylvia_gulubova
Data Storage
11-27-2024
Solved

Date Filter -- allow users to only choose a value from list of days

How is it possible to limit user actions with date filters (like the one below) to only choose a value from list of days and nothing else (change the list format to months/years, use calendar, time frame, ranking, allow multiple selections, etc.)?

  • AssafHanina's avatar
    AssafHanina
    12-02-2024

    Hey sylvia_gulubova ,

    Date Filter allow different Granularities such as Years, Quarters, Months, Weeks and Days. 
    In Version L2024.1 the New UI Filters are enabled which provide different view as the screenshot shared which using the old filters UI/UX. 
    In both cases, using the Dependent filter will allow switching the Granularities which isn't sufficient in this case. 

    I would refer to the second option which is creating a blox drop down filter that allow a single select for Days.

    1. Create a Blox widget and Add the Date Column with Days granularity. Please find an Example.
    2. Add the Date as dashboard filter and Hide it 
     
     

    Blox Example

    {
        "showCarousel": true,
        "carouselAnimation": {
            "delay": 0,
            "showButtons": false
        },
        "body": [
            {
                "type": "Container",
                "style": {
                    "justify-items": "center",
                    "align-items": "center"
                },
                "items": [
                    {
                        "type": "TextBlock",
                        "spacing": "medium",
                        "size": "large",
                        "text": "Select date",
                        "style": {
                            "text-align": "center",
                            "font-weight": "600"
                        }
                    },
                    {
                        "type": "Container",
                        "spacing": "small",
                        "items": [
                            {
                                "type": "Input.ChoiceSet",
                                "id": "data.filters[0].filterJaql.members[0]",
                                "class": "",
                                "value": "PDAs",
                                "displayType": "compact",
                                "style": {
                                    "align-self": "center"
                                },
                                "choices": "{choices:Date}"
                            }
                        ]
                    }
                ]
            }
        ],
        "actions": [
            {
                "type": "Filters",
                "title": "Filter!",
                "data": {
                    "filters": [
                        {
                            "panelName": "Date",
                            "filterJaql": {
                                "explicit": true,
                                "members": [
                                    ""
                                ]
                            }
                        }
                    ]
                }
            },
            {
                "type": "Filters",
                "title": "Clear",
                "data": {
                    "filters": [
                        {
                            "panelName": "Date",
                            "filterJaql": {
                                "explicit": true,
                                "all": true
                            }
                        }
                    ]
                }
            }
        ]
    }

    Best Regards

     

6 Replies

  • Hi sylvia_gulubova ,

    In addition to AssafHanina  solution, I’d like to propose a different approach.
    By using the Advanced Filters plugin and hiding the filter from the filters panel—either through a script or with our FREE Hide Filters plugin—you can easily achieve the functionality you’re looking for. This ensures that users are restricted to selecting only one date.

     

    This method is versatile and can also be applied to other scenarios, such as date range selection, restricting date ranges, dependency filters, and more.

     

    Feel free to reach out if you have further questions, we're always happy to help (: 
    Paldi Solutions - Number #1 Sisense Plugins Developer 
  • AssafHanina's avatar
    AssafHanina
    Sisense Employee

    Hey sylvia_gulubova ,

    Please find a potential Solutions to achieve a dropdown list for Days Granularity:

    Option 1 - Add 2 date filters and hide the parent filter

    • First Filter - with Years granularity (For Example) which set to include all.
    • Second Filter is Dependent Filter with Days granularity. 

    When setting up a dependent filter, the only available option is a List, which can be configured for either Single or Multi-Select. This approach supports both filters and allows the flexibility to hide the Parent filter if users are not expected to interact with it, as describe in following Community Article.
    Additionally, the Parent filter may need to be included as it slices the selected members within the days filter.

    After Hiding the Column

    Additional option is to create a Blox Dropdown filter that include the Days members in the dropdown.
    Please find related community article

    best regards

  • Hello AssafHanina 

    I've tried option one and the result is not what I've expected (see the screenshots below)
    After "parent" filter was hidden, "dependent" filter still have options to choose Week for example.
    Tested with Sisense L2024.1 as dashboard owner and as a different user.




    • AssafHanina's avatar
      AssafHanina
      Sisense Employee

      Hey sylvia_gulubova ,

      Date Filter allow different Granularities such as Years, Quarters, Months, Weeks and Days. 
      In Version L2024.1 the New UI Filters are enabled which provide different view as the screenshot shared which using the old filters UI/UX. 
      In both cases, using the Dependent filter will allow switching the Granularities which isn't sufficient in this case. 

      I would refer to the second option which is creating a blox drop down filter that allow a single select for Days.

      1. Create a Blox widget and Add the Date Column with Days granularity. Please find an Example.
      2. Add the Date as dashboard filter and Hide it 
       
       

      Blox Example

      {
          "showCarousel": true,
          "carouselAnimation": {
              "delay": 0,
              "showButtons": false
          },
          "body": [
              {
                  "type": "Container",
                  "style": {
                      "justify-items": "center",
                      "align-items": "center"
                  },
                  "items": [
                      {
                          "type": "TextBlock",
                          "spacing": "medium",
                          "size": "large",
                          "text": "Select date",
                          "style": {
                              "text-align": "center",
                              "font-weight": "600"
                          }
                      },
                      {
                          "type": "Container",
                          "spacing": "small",
                          "items": [
                              {
                                  "type": "Input.ChoiceSet",
                                  "id": "data.filters[0].filterJaql.members[0]",
                                  "class": "",
                                  "value": "PDAs",
                                  "displayType": "compact",
                                  "style": {
                                      "align-self": "center"
                                  },
                                  "choices": "{choices:Date}"
                              }
                          ]
                      }
                  ]
              }
          ],
          "actions": [
              {
                  "type": "Filters",
                  "title": "Filter!",
                  "data": {
                      "filters": [
                          {
                              "panelName": "Date",
                              "filterJaql": {
                                  "explicit": true,
                                  "members": [
                                      ""
                                  ]
                              }
                          }
                      ]
                  }
              },
              {
                  "type": "Filters",
                  "title": "Clear",
                  "data": {
                      "filters": [
                          {
                              "panelName": "Date",
                              "filterJaql": {
                                  "explicit": true,
                                  "all": true
                              }
                          }
                      ]
                  }
              }
          ]
      }

      Best Regards

       

    • AssafHanina's avatar
      AssafHanina
      Sisense Employee

      Hey sylvia_gulubova ,

      Date Filter allow different Granularities such as Years, Quarters, Months, Weeks and Days. 
      In Version L2024.1 the New UI Filters are enabled which provide different view as the screenshot shared which using the old filters UI/UX. 
      In both cases, using the Dependent filter will allow switching the Granularities which isn't sufficient in this case. 

      I would refer to the second option which is creating a blox drop down filter that allow a single select for Days.

      1. Create a Blox widget and Add the Date Column with Days granularity. Please find an Example.
      2. Add the Date as dashboard filter and Hide it 
       
       

      Blox Example

      {
          "showCarousel": true,
          "carouselAnimation": {
              "delay": 0,
              "showButtons": false
          },
          "body": [
              {
                  "type": "Container",
                  "style": {
                      "justify-items": "center",
                      "align-items": "center"
                  },
                  "items": [
                      {
                          "type": "TextBlock",
                          "spacing": "medium",
                          "size": "large",
                          "text": "Select date",
                          "style": {
                              "text-align": "center",
                              "font-weight": "600"
                          }
                      },
                      {
                          "type": "Container",
                          "spacing": "small",
                          "items": [
                              {
                                  "type": "Input.ChoiceSet",
                                  "id": "data.filters[0].filterJaql.members[0]",
                                  "class": "",
                                  "value": "PDAs",
                                  "displayType": "compact",
                                  "style": {
                                      "align-self": "center"
                                  },
                                  "choices": "{choices:Date}"
                              }
                          ]
                      }
                  ]
              }
          ],
          "actions": [
              {
                  "type": "Filters",
                  "title": "Filter!",
                  "data": {
                      "filters": [
                          {
                              "panelName": "Date",
                              "filterJaql": {
                                  "explicit": true,
                                  "members": [
                                      ""
                                  ]
                              }
                          }
                      ]
                  }
              },
              {
                  "type": "Filters",
                  "title": "Clear",
                  "data": {
                      "filters": [
                          {
                              "panelName": "Date",
                              "filterJaql": {
                                  "explicit": true,
                                  "all": true
                              }
                          }
                      ]
                  }
              }
          ]
      }

      Best Regards

       

  • Hello sylvia_gulubova,

    I’m following up to see if the solutions offered by Benji_PaldiTeam and AssafHanina  worked for you.

    If so, please click the 'Accept as Solution' button on the appropriate post. That way other users with the same questions can find the answer. If not, please let us know so that we can continue to help.

    Thank you.