cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

Visualizations failing to show

Erik_L
Contributor II

I have a SQL query that generates a table. I created a visualization from that table with the UI. I then have a widget that updates a value used in the query and re-runs the SQL, but then the visualization shows nothing, that there is "1 row," but if I select the table it shows all the rows and if I click "edit visualization" it shows the correct visualization. What's wrong with visualizations?

 

Screenshot from 2024-04-05 10-23-03.png

2 REPLIES 2

Kaniz
Community Manager
Community Manager

Hi @Erik_L , It seems like you’re encountering an issue with your visualization in Databricks.

Let’s troubleshoot this!

Here are a few common reasons why visualizations might not display as expected:

  1. Data Issues:

    • Ensure that your SQL query is correctly generating the table data. Check for any missing or incomplete data, formatting issues, or incorrect data relationships within your dataset.
    • Verify that the widget’s updated value is being correctly incorporated into the query.
  2. Filters and Slicers:

    • Visual-level filters and slicers can impact which data is displayed in your visuals. If they are not set correctly, they may inadvertently filter out all data, resulting in empty visuals.
    • Consider checking the interactions between your slicer and other visuals. By default, if nothing is selected in a slicer, all records are shown in visuals where the interactions are set as filters. You can customize this behavior.
  3. Visual-Level Filters:

  4. Index Column:

    • Try adding an index column to your data and include it in your visual. This can help avoid issues related to duplicate data.

Remember to thoroughly review your query, filters, and interactions to identify any discrepancies. 

 

Erik_L
Contributor II

To be clear: the data is correct in the table. It's also correctly displayed if I click "edit visualization." It's only the re-run visualization in the notebook / dashboard that is empty when I update a widget to use a different value.

The code looks something like:

location = dbutils.widgets.get("locations")
ids = spark.read.table("production.gold.devices").select("id").where(f"location = '{location}'").distinct().toPandas()['id']
dbutils.widgets.dropdown('device_ids', values=ids, default='', label='Device IDs')

# ... Another cell

device_id = dbutils.widgets.get('device_ids')
spark.read.table("production.gold.data").where(f"location = '{location}' AND device_id = '{device_id}' AND create_time > now() - INTERVAL 30 DAYS")

# PowerBI Linear graph visualization

 

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.