cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Inquiry About Adding Filters on Notebook Dashboard

amarnathpal
New Contributor

Subject: Inquiry About Adding Filters on Notebook Dashboard

Hi

I have recently created some visuals on Notebook and added them to the Notebook dashboard. However, I am unable to find a way to add filters to the dashboard. I have looked through the available options but have not found anything related to filters.

Please note that I am referring to the Notebook dashboard and not the SQL Dashboard.

I would appreciate any guidance on how I can add filters to the Notebook dashboard.

4 REPLIES 4

shashank853
Databricks Employee
Databricks Employee

@amarnathpal Thank you for bringing this.
Currently, it is not possible to add filters directly to a Notebook dashboard in Databricks. The available options for adding filters are specific to AI/BI dashboards, which offer more advanced features such as cross-filtering, independent user sessions, and better scalability and management.
If you need to use filters, you might consider transitioning your notebook visualizations to an AI/BI dashboard. This can be done by using the "Add to Dashboard" option available for SQL cells in notebooks. This integration allows you to move your SQL cell content, including queries, parameters, and visualizations, to an AI/BI dashboard where you can then add and configure filters as needed
Check this: https://www.databricks.com/blog/present-and-share-notebook-results-in-aibi-dashboards

hari-prasad
Valued Contributor

Hi @amarnathpal ,

Please follow the steps below (1 to 5) from snapshot to add filters to your dashboard. Additionally, you may need to explore using parameters to customize your filters for optimized value selections.

hariprasad_0-1736500063896.png

Regards,
Hari Prasad



Regards,
Hari Prasad

Hi @hari-prasad ,

Thank you for your prompt response. The solution you provided seems suitable for an SQL Dashboard. However, my inquiry was specifically about the capabilities of the Notebook Dashboard.

To elaborate, I have displayed data in a notebook and created visuals accordingly. Upon adding these visuals to the dashboard using the "Add to Notebook Dashboard" option, it appears that the Notebook Dashboard lacks several features that I was hoping to access.

Could you please confirm if there are additional functionalities or workarounds available for enhancing the Notebook Dashboard, such as implementing filters directly within it?

hari-prasad
Valued Contributor

Then you can use alternate way, which is to use widgets in databricks which you can leverage to parametrize your notebook and queries. And any changes to parameter will auto trigger the code block where you read parameter in cell.

Also, you can set action on widget changes like sepecific cell or complete notebook.

hariprasad_0-1736503840320.png

Here is a sample Python code. Please note that the auto-trigger/execute functionality for specific cells only works with Python. For SQL, you need to templatize your queries in spark.sql. Ensure you include the following code line dbutils.widgets.get("catalog_name_param") in the cell to enable auto-triggering.

 

# To create a widget in the notebook, use the following command:
dbutils.widgets.text("catalog_name_param", "")
# Read parameter in notebook with templatized SQL query
query = """
select * from system.information_schema.catalog_privileges
where catalog_name like :catalog_name_param
"""

args = {"catalog_name_param": dbutils.widgets.get("catalog_name_param")}

df = spark.sql(query, args)
display(df)

 

hariprasad_2-1736504271526.png

 



Regards,
Hari Prasad

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group